From 9710f75d4a4d57fa86f20e011c6dc6e66c590080 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sun, 3 Feb 2002 19:39:52 +0000 Subject: Update. 2002-02-03 Andreas Schwab * sysdeps/posix/readv.c: Use ssize_t for bytes_read. * sysdeps/posix/writev.c: Use ssize_t for bytes_written. Fix comment. 2002-02-03 Thorsten Kukuk * sysdeps/posix/writev.c: Check for ssize_t overflow, don't use alloca if the memory reqirements are too high. 2002-02-03 Ulrich Drepper * elf/dl-load.c (decompose_rpath): Avoid using strstr. * elf/dl-minimal.c (_strerror_r): Use _itoa instead of _itoa_word since the former is available anyway and speed isn't important here. * elf/dl-misc.c (_dl_debug_vdprintf): Likewise. * elf/dl-version.c (match_symbol): Likewise. (_dl_check_map_versions): Likewise. * elf/rtld.c (process_envvars): Likewise. (print_statistics): Likewise. * sysdeps/generic/dl-sysdep.c (_dl_show_auxv): Likewise. * elf/dl-minimal.c (_itoa): Always define it. Make it work for all bases. Add assert to catch uses of unimplemented features. (__strsep): Add assert to catch uses of unimplemented features. * elf/dl-object.c (_dl_new_object): Don't use rawmemchr. Use strchr and avoid inline optimization. * elf/rtld.c (process_envvars): Likewise. * elf/dl-open.c: Don't include . * elf/dl-profile.c (_dl_start_profile): Help compiler to avoid ffs. * elf/rtld.c (dl_main): Avoid strsep inline optimization. * stdio-common/_itoa.h: Minor simplifications of the code. * stdio-common/_itoa.c: Likewise. * elf/dl-reloc.c (_dl_relocate_object): Use _dl_debug_printf instead of _dl_printf for debugging info output. * sysdeps/mips/atomicity.h (exchange_and_add): Use branch likely. --- stdio-common/_itoa.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'stdio-common/_itoa.c') diff --git a/stdio-common/_itoa.c b/stdio-common/_itoa.c index 1c29df62de..e36cd520f7 100644 --- a/stdio-common/_itoa.c +++ b/stdio-common/_itoa.c @@ -1,5 +1,5 @@ /* Internal function for converting integers to ASCII. - Copyright (C) 1994, 1995, 1996, 1999, 2000 Free Software Foundation, Inc. + Copyright (C) 1994,1995,1996,1999,2000,2002 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Torbjorn Granlund and Ulrich Drepper . @@ -170,7 +170,6 @@ _itoa (value, buflim, base, upper_case) int upper_case; { const char *digits = upper_case ? _itoa_upper_digits : _itoa_lower_digits; - char *bp = buflim; const struct base_table_t *brec = &_itoa_base_table[base - 2]; switch (base) @@ -191,7 +190,7 @@ _itoa (value, buflim, base, upper_case) work_lo = value & 0xfffffffful; \ for (cnt = BITS_PER_MP_LIMB / BITS; cnt > 0; --cnt) \ { \ - *--bp = digits[work_lo & ((1ul << BITS) - 1)]; \ + *--buflim = digits[work_lo & ((1ul << BITS) - 1)]; \ work_lo >>= BITS; \ } \ if (BITS_PER_MP_LIMB % BITS != 0) \ @@ -205,7 +204,7 @@ _itoa (value, buflim, base, upper_case) if (work_hi == 0) \ work_hi = work_lo; \ else \ - *--bp = digits[work_lo]; \ + *--buflim = digits[work_lo]; \ } \ } \ else \ @@ -213,7 +212,7 @@ _itoa (value, buflim, base, upper_case) } \ do \ { \ - *--bp = digits[work_hi & ((1 << BITS) - 1)]; \ + *--buflim = digits[work_hi & ((1 << BITS) - 1)]; \ work_hi >>= BITS; \ } \ while (work_hi != 0); \ @@ -239,7 +238,7 @@ _itoa (value, buflim, base, upper_case) umul_ppmm (x, dummy, value, base_multiplier); quo = (x + ((value - x) >> 1)) >> (brec->post_shift - 1); rem = value - quo * base; - *--bp = digits[rem]; + *--buflim = digits[rem]; value = quo; } else @@ -250,7 +249,7 @@ _itoa (value, buflim, base, upper_case) umul_ppmm (x, dummy, value, base_multiplier); quo = x >> brec->post_shift; rem = value - quo * base; - *--bp = digits[rem]; + *--buflim = digits[rem]; value = quo; } #endif @@ -376,7 +375,7 @@ _itoa (value, buflim, base, upper_case) umul_ppmm (x, dummy, ti, base_multiplier); quo = (x + ((ti - x) >> 1)) >> (brec->post_shift - 1); rem = ti - quo * base; - *--bp = digits[rem]; + *--buflim = digits[rem]; ti = quo; ++ndig_for_this_limb; } @@ -388,7 +387,7 @@ _itoa (value, buflim, base, upper_case) umul_ppmm (x, dummy, ti, base_multiplier); quo = x >> brec->post_shift; rem = ti - quo * base; - *--bp = digits[rem]; + *--buflim = digits[rem]; ti = quo; ++ndig_for_this_limb; } @@ -399,7 +398,7 @@ _itoa (value, buflim, base, upper_case) quo = ti / base; rem = ti % base; - *--bp = digits[rem]; + *--buflim = digits[rem]; ti = quo; ++ndig_for_this_limb; } @@ -408,7 +407,7 @@ _itoa (value, buflim, base, upper_case) if (n != 0) while (ndig_for_this_limb < brec->big.ndigits) { - *--bp = '0'; + *--buflim = '0'; ++ndig_for_this_limb; } } @@ -418,5 +417,5 @@ _itoa (value, buflim, base, upper_case) break; } - return bp; + return buflim; } -- cgit v1.2.3