1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-07 06:43:00 +03:00

* stdio-common/_itowa.c: Don't compile _itowa for 64-bit

platforms.
	* stdio-common/_itoa.c: Don't compile in _itoa and _fitoa for
	64-bit platforms.
	* malloc/mtrace.c (tr_where): Use _fitoa_word instead of _fitoa if
	possible.
	* posix/wordexp.c (parse_arith): Use _itoa_word instead of _itoa
	if possible.
This commit is contained in:
Ulrich Drepper
2007-01-22 21:21:52 +00:00
parent 6cae39579b
commit 765bbb24bd
5 changed files with 84 additions and 54 deletions

View File

@@ -1,5 +1,14 @@
2007-01-22 Ulrich Drepper <drepper@redhat.com>
* stdio-common/_itowa.c: Don't compile _itowa for 64-bit
platforms.
* stdio-common/_itoa.c: Don't compile in _itoa and _fitoa for
64-bit platforms.
* malloc/mtrace.c (tr_where): Use _fitoa_word instead of _fitoa if
possible.
* posix/wordexp.c (parse_arith): Use _itoa_word instead of _itoa
if possible.
[BZ #3902]
* stdio-common/_itoa.c (_itoa): Make sure at least a zero is emitted.
* stdio-common/Makefile (tests): Add bug17.

View File

@@ -1,5 +1,5 @@
/* More debugging hooks for `malloc'.
Copyright (C) 1991-1994,1996-2003, 2004 Free Software Foundation, Inc.
Copyright (C) 1991-1994,1996-2004, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written April 2, 1991 by John Gilmore of Cygnus Support.
Based on mcheck.c by Mike Haertel.
@@ -28,6 +28,7 @@
#include <dlfcn.h>
#include <fcntl.h>
#include <limits.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -113,15 +114,20 @@ tr_where (caller)
buf = alloca (len + 6 + 2 * sizeof (void *));
buf[0] = '(';
__stpcpy (_fitoa (caller >= (const __ptr_t) info.dli_saddr
? caller - (const __ptr_t) info.dli_saddr
: (const __ptr_t) info.dli_saddr - caller,
__stpcpy (__mempcpy (buf + 1, info.dli_sname,
len),
char *cp = __stpcpy (__mempcpy (buf + 1, info.dli_sname, len),
caller >= (__ptr_t) info.dli_saddr
? "+0x" : "-0x"),
16, 0),
")");
? "+0x" : "-0x");
intptr_t offset = (caller >= (const __ptr_t) info.dli_saddr
? caller - (const __ptr_t) info.dli_saddr
: (const __ptr_t) info.dli_saddr - caller);
# if LLONG_MAX == LONG_MAX
cp = _fitoa_word (offset, cp, 16, 0);
# else
cp = _fitoa (offset, cp, 16, 0);
# endif
__stpcpy (cp, ")");
}
fprintf (mallstream, "@ %s%s%s[%p] ",

View File

@@ -1,5 +1,5 @@
/* POSIX.2 wordexp implementation.
Copyright (C) 1997-2002, 2003, 2005, 2006 Free Software Foundation, Inc.
Copyright (C) 1997-2003, 2005, 2006, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Tim Waugh <tim@cyberelk.demon.co.uk>.
@@ -25,6 +25,7 @@
#include <fnmatch.h>
#include <glob.h>
#include <libintl.h>
#include <limits.h>
#include <paths.h>
#include <pwd.h>
#include <signal.h>
@@ -757,8 +758,13 @@ parse_arith (char **word, size_t *word_length, size_t *max_length,
convertme = numresult;
result[20] = '\0';
*word = w_addstr (*word, word_length, max_length,
_itoa (convertme, &result[20], 10, 0));
char *numstr;
#if LLONG_MAX == LONG_MAX
numstr = _itoa_word (convertme, &result[20], 10, 0);
#else
numstr = _itoa (convertme, &result[20], 10, 0);
#endif
*word = w_addstr (*word, word_length, max_length, numstr);
free (expr);
return *word ? 0 : WRDE_NOSPACE;
}

View File

@@ -78,6 +78,8 @@ struct base_table_t
#endif
/* We do not compile _itoa if we always can use _itoa_word. */
#if LLONG_MAX != LONG_MAX
/* Local variables. */
const struct base_table_t _itoa_base_table[] attribute_hidden =
{
@@ -156,6 +158,7 @@ const struct base_table_t _itoa_base_table[] attribute_hidden =
/* 36 */ {SEL1(0x38e38e39ul) 0, 3, {0, 6, 0x81bf1000ul SEL2(0xf91bd1b6ul)}}
# endif
};
#endif
/* Lower-case digits. */
extern const char _itoa_lower_digits[];
@@ -201,6 +204,7 @@ _itoa_word (unsigned long value, char *buflim,
#undef SPECIAL
#if LLONG_MAX != LONG_MAX
char *
_itoa (value, buflim, base, upper_case)
unsigned long long int value;
@@ -373,7 +377,7 @@ _itoa (value, buflim, base, upper_case)
}
else
{
#if (UDIV_TIME > 2 * UMUL_TIME)
# if UDIV_TIME > 2 * UMUL_TIME
mp_limb_t x;
value <<= brec->big.normalization_steps;
@@ -463,6 +467,7 @@ _itoa (value, buflim, base, upper_case)
return buflim;
}
#endif
char *
_fitoa_word (unsigned long value, char *buf, unsigned int base, int upper_case)
@@ -474,6 +479,7 @@ _fitoa_word (unsigned long value, char *buf, unsigned int base, int upper_case)
return buf;
}
#if LLONG_MAX != LONG_MAX
char *
_fitoa (unsigned long long value, char *buf, unsigned int base, int upper_case)
{
@@ -483,3 +489,4 @@ _fitoa (unsigned long long value, char *buf, unsigned int base, int upper_case)
*buf++ = *cp++;
return buf;
}
#endif

View File

@@ -1,5 +1,5 @@
/* Internal function for converting integers to ASCII.
Copyright (C) 1994,1995,1996,1999,2000,2002 Free Software Foundation, Inc.
Copyright (C) 1994-1996,1999,2000,2002,2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Torbjorn Granlund <tege@matematik.su.se>
and Ulrich Drepper <drepper@gnu.org>.
@@ -85,6 +85,7 @@ extern const wchar_t _itowa_lower_digits[] attribute_hidden;
extern const wchar_t _itowa_upper_digits[] attribute_hidden;
#if LLONG_MAX != LONG_MAX
wchar_t *
_itowa (value, buflim, base, upper_case)
unsigned long long int value;
@@ -256,7 +257,7 @@ _itowa (value, buflim, base, upper_case)
}
else
{
#if (UDIV_TIME > 2 * UMUL_TIME)
# if UDIV_TIME > 2 * UMUL_TIME
mp_limb_t x;
value <<= brec->big.normalization_steps;
@@ -344,3 +345,4 @@ _itowa (value, buflim, base, upper_case)
return bp;
}
#endif