strfmon.c (178312) | strfmon.c (178313) |
---|---|
1/*- 2 * Copyright (c) 2001 Alexey Zelkin <phantom@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 12 unchanged lines hidden (view full) --- 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 */ 27 28#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2001 Alexey Zelkin <phantom@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 12 unchanged lines hidden (view full) --- 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 */ 27 28#include <sys/cdefs.h> |
29__FBSDID("$FreeBSD: head/lib/libc/stdlib/strfmon.c 178312 2008-04-19 07:18:22Z ru $"); | 29__FBSDID("$FreeBSD: head/lib/libc/stdlib/strfmon.c 178313 2008-04-19 07:22:58Z ru $"); |
30 31#include <sys/types.h> 32#include <ctype.h> 33#include <errno.h> 34#include <limits.h> 35#include <locale.h> 36#include <monetary.h> 37#include <stdarg.h> --- 182 unchanged lines hidden (view full) --- 220 case 'n': /* use national currency format */ 221 flags &= ~(USE_INTL_CURRENCY); 222 break; 223 default: /* required character is missing or 224 premature EOS */ 225 goto format_error; 226 } 227 | 30 31#include <sys/types.h> 32#include <ctype.h> 33#include <errno.h> 34#include <limits.h> 35#include <locale.h> 36#include <monetary.h> 37#include <stdarg.h> --- 182 unchanged lines hidden (view full) --- 220 case 'n': /* use national currency format */ 221 flags &= ~(USE_INTL_CURRENCY); 222 break; 223 default: /* required character is missing or 224 premature EOS */ 225 goto format_error; 226 } 227 |
228 if (currency_symbol != NULL) 229 free(currency_symbol); |
|
228 if (flags & USE_INTL_CURRENCY) { 229 currency_symbol = strdup(lc->int_curr_symbol); 230 if (currency_symbol != NULL) 231 space_char = *(currency_symbol+3); 232 } else 233 currency_symbol = strdup(lc->currency_symbol); 234 235 if (currency_symbol == NULL) --- 12 unchanged lines hidden (view full) --- 248 if (left_prec >= 0) { 249 pad_size = __calc_left_pad((flags ^ IS_NEGATIVE), 250 currency_symbol) - 251 __calc_left_pad(flags, currency_symbol); 252 if (pad_size < 0) 253 pad_size = 0; 254 } 255 | 230 if (flags & USE_INTL_CURRENCY) { 231 currency_symbol = strdup(lc->int_curr_symbol); 232 if (currency_symbol != NULL) 233 space_char = *(currency_symbol+3); 234 } else 235 currency_symbol = strdup(lc->currency_symbol); 236 237 if (currency_symbol == NULL) --- 12 unchanged lines hidden (view full) --- 250 if (left_prec >= 0) { 251 pad_size = __calc_left_pad((flags ^ IS_NEGATIVE), 252 currency_symbol) - 253 __calc_left_pad(flags, currency_symbol); 254 if (pad_size < 0) 255 pad_size = 0; 256 } 257 |
258 if (asciivalue != NULL) 259 free(asciivalue); |
|
256 asciivalue = __format_grouped_double(value, &flags, 257 left_prec, right_prec, pad_char); 258 if (asciivalue == NULL) 259 goto end_error; /* errno already set */ 260 /* to ENOMEM by malloc() */ 261 262 /* set some variables for later use */ 263 __setup_vars(flags, &cs_precedes, &sep_by_space, --- 347 unchanged lines hidden --- | 260 asciivalue = __format_grouped_double(value, &flags, 261 left_prec, right_prec, pad_char); 262 if (asciivalue == NULL) 263 goto end_error; /* errno already set */ 264 /* to ENOMEM by malloc() */ 265 266 /* set some variables for later use */ 267 __setup_vars(flags, &cs_precedes, &sep_by_space, --- 347 unchanged lines hidden --- |