diff options
Diffstat (limited to 'sysdeps')
29 files changed, 120 insertions, 28 deletions
diff --git a/sysdeps/generic/_itoa.h b/sysdeps/generic/_itoa.h new file mode 100644 index 0000000000..8870ee0286 --- /dev/null +++ b/sysdeps/generic/_itoa.h @@ -0,0 +1,92 @@ +/* Internal function for converting integers to ASCII. + Copyright (C) 1994-1999,2002,2003,2007 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + <http://www.gnu.org/licenses/>. */ + +#ifndef _ITOA_H +#define _ITOA_H + +#include <limits.h> + +/* Convert VALUE into ASCII in base BASE (2..36). + Write backwards starting the character just before BUFLIM. + Return the address of the first (left-to-right) character in the number. + Use upper case letters iff UPPER_CASE is nonzero. */ + +extern char *_itoa (unsigned long long int value, char *buflim, + unsigned int base, int upper_case); + +extern const char _itoa_upper_digits[]; +extern const char _itoa_upper_digits_internal[] attribute_hidden; +extern const char _itoa_lower_digits[]; +extern const char _itoa_lower_digits_internal[] attribute_hidden; + +#ifndef NOT_IN_libc +extern char *_itoa_word (unsigned long value, char *buflim, + unsigned int base, int upper_case); +#else +static inline char * __attribute__ ((unused, always_inline)) +_itoa_word (unsigned long value, char *buflim, + unsigned int base, int upper_case) +{ + const char *digits = (upper_case +# if defined IS_IN_rtld + ? INTUSE(_itoa_upper_digits) + : INTUSE(_itoa_lower_digits) +# else + ? _itoa_upper_digits + : _itoa_lower_digits +# endif + ); + + switch (base) + { +# define SPECIAL(Base) \ + case Base: \ + do \ + *--buflim = digits[value % Base]; \ + while ((value /= Base) != 0); \ + break + + SPECIAL (10); + SPECIAL (16); + SPECIAL (8); + default: + do + *--buflim = digits[value % base]; + while ((value /= base) != 0); + } + return buflim; +} +# undef SPECIAL +#endif + +/* Similar to the _itoa functions, but output starts at buf and pointer + after the last written character is returned. */ +extern char *_fitoa_word (unsigned long value, char *buf, unsigned int base, + int upper_case) attribute_hidden; +extern char *_fitoa (unsigned long long value, char *buf, unsigned int base, + int upper_case) attribute_hidden; + +#if LONG_MAX == LLONG_MAX +/* No need for special long long versions. */ +# define _itoa(value, buf, base, upper_case) \ + _itoa_word (value, buf, base, upper_case) +# define _fitoa(value, buf, base, upper_case) \ + _fitoa_word (value, buf, base, upper_case) +#endif + +#endif /* itoa.h */ diff --git a/sysdeps/generic/elf/backtracesymsfd.c b/sysdeps/generic/elf/backtracesymsfd.c index 8b4a836ce9..3562c50a78 100644 --- a/sysdeps/generic/elf/backtracesymsfd.c +++ b/sysdeps/generic/elf/backtracesymsfd.c @@ -21,7 +21,7 @@ #include <string.h> #include <sys/uio.h> -#include <stdio-common/_itoa.h> +#include <_itoa.h> #include <ldsodefs.h> #if __ELF_NATIVE_CLASS == 32 diff --git a/sysdeps/i386/i686/hp-timing.h b/sysdeps/i386/i686/hp-timing.h index 852f77820f..1d8684ce20 100644 --- a/sysdeps/i386/i686/hp-timing.h +++ b/sysdeps/i386/i686/hp-timing.h @@ -22,7 +22,7 @@ #include <string.h> #include <sys/param.h> -#include <stdio-common/_itoa.h> +#include <_itoa.h> /* The macros defined here use the timestamp counter in i586 and up versions of the x86 processors. They provide a very accurate way to measure the diff --git a/sysdeps/mach/_strerror.c b/sysdeps/mach/_strerror.c index 3c0928825f..e3a5c8e3c8 100644 --- a/sysdeps/mach/_strerror.c +++ b/sysdeps/mach/_strerror.c @@ -21,7 +21,7 @@ #include <mach/error.h> #include <errorlib.h> #include <sys/param.h> -#include <stdio-common/_itoa.h> +#include <_itoa.h> /* It is critical here that we always use the `dcgettext' function for the message translation. Since <libintl.h> only defines the macro diff --git a/sysdeps/mach/hurd/powerpc/register-dump.h b/sysdeps/mach/hurd/powerpc/register-dump.h index 258579727e..80d545e488 100644 --- a/sysdeps/mach/hurd/powerpc/register-dump.h +++ b/sysdeps/mach/hurd/powerpc/register-dump.h @@ -17,7 +17,7 @@ <http://www.gnu.org/licenses/>. */ #include <sys/uio.h> -#include <stdio-common/_itoa.h> +#include <_itoa.h> /* This prints out the information in the following form: */ static const char dumpform[] = "\ diff --git a/sysdeps/mach/hurd/sethostid.c b/sysdeps/mach/hurd/sethostid.c index d1ff1b0f5b..7fadf6aa85 100644 --- a/sysdeps/mach/hurd/sethostid.c +++ b/sysdeps/mach/hurd/sethostid.c @@ -18,7 +18,7 @@ #include <unistd.h> #include <hurd.h> #include "hurdhost.h" -#include <stdio-common/_itoa.h> +#include <_itoa.h> /* Set the current machine's Internet number to ID. This call is restricted to the super-user. */ diff --git a/sysdeps/mach/hurd/xmknodat.c b/sysdeps/mach/hurd/xmknodat.c index a37b918822..acd1a8c683 100644 --- a/sysdeps/mach/hurd/xmknodat.c +++ b/sysdeps/mach/hurd/xmknodat.c @@ -23,7 +23,7 @@ #include <hurd/fd.h> #include <hurd/paths.h> #include <fcntl.h> -#include "stdio-common/_itoa.h" +#include <_itoa.h> #include <string.h> #include <sys/types.h> diff --git a/sysdeps/mach/xpg-strerror.c b/sysdeps/mach/xpg-strerror.c index 997c5b6a3f..421d75803d 100644 --- a/sysdeps/mach/xpg-strerror.c +++ b/sysdeps/mach/xpg-strerror.c @@ -23,7 +23,7 @@ #include <mach/error.h> #include <errorlib.h> #include <sys/param.h> -#include <stdio-common/_itoa.h> +#include <_itoa.h> /* It is critical here that we always use the `dcgettext' function for the message translation. Since <libintl.h> only defines the macro diff --git a/sysdeps/powerpc/powerpc32/dl-machine.c b/sysdeps/powerpc/powerpc32/dl-machine.c index 9ad6bbbc0b..e535480133 100644 --- a/sysdeps/powerpc/powerpc32/dl-machine.c +++ b/sysdeps/powerpc/powerpc32/dl-machine.c @@ -23,7 +23,7 @@ #include <ldsodefs.h> #include <elf/dynamic-link.h> #include <dl-machine.h> -#include <stdio-common/_itoa.h> +#include <_itoa.h> /* The value __cache_line_size is defined in dl-sysdep.c and is initialised by _dl_sysdep_start via DL_PLATFORM_INIT. */ diff --git a/sysdeps/powerpc/powerpc32/power4/hp-timing.h b/sysdeps/powerpc/powerpc32/power4/hp-timing.h index 8370f72691..a80168a7c9 100644 --- a/sysdeps/powerpc/powerpc32/power4/hp-timing.h +++ b/sysdeps/powerpc/powerpc32/power4/hp-timing.h @@ -22,7 +22,7 @@ #include <string.h> #include <sys/param.h> -#include <stdio-common/_itoa.h> +#include <_itoa.h> #include <atomic.h> /* The macros defined here use the powerpc 64-bit time base register. diff --git a/sysdeps/powerpc/powerpc32/register-dump.h b/sysdeps/powerpc/powerpc32/register-dump.h index d9b520e5e7..2936de240b 100644 --- a/sysdeps/powerpc/powerpc32/register-dump.h +++ b/sysdeps/powerpc/powerpc32/register-dump.h @@ -17,7 +17,7 @@ <http://www.gnu.org/licenses/>. */ #include <sys/uio.h> -#include <stdio-common/_itoa.h> +#include <_itoa.h> /* This prints out the information in the following form: */ static const char dumpform[] = "\ diff --git a/sysdeps/powerpc/powerpc64/dl-machine.c b/sysdeps/powerpc/powerpc64/dl-machine.c index 6a8e68f39e..8e216ed87c 100644 --- a/sysdeps/powerpc/powerpc64/dl-machine.c +++ b/sysdeps/powerpc/powerpc64/dl-machine.c @@ -19,7 +19,7 @@ #include <string.h> #include <unistd.h> #include <ldsodefs.h> -#include <stdio-common/_itoa.h> +#include <_itoa.h> #include <dl-machine.h> void diff --git a/sysdeps/powerpc/powerpc64/hp-timing.h b/sysdeps/powerpc/powerpc64/hp-timing.h index b4cf2a42cb..dc10bc4f65 100644 --- a/sysdeps/powerpc/powerpc64/hp-timing.h +++ b/sysdeps/powerpc/powerpc64/hp-timing.h @@ -22,7 +22,7 @@ #include <string.h> #include <sys/param.h> -#include <stdio-common/_itoa.h> +#include <_itoa.h> #include <atomic.h> /* The macros defined here use the powerpc 64-bit time base register. diff --git a/sysdeps/powerpc/powerpc64/register-dump.h b/sysdeps/powerpc/powerpc64/register-dump.h index e301b0fe61..917886db2f 100644 --- a/sysdeps/powerpc/powerpc64/register-dump.h +++ b/sysdeps/powerpc/powerpc64/register-dump.h @@ -17,7 +17,7 @@ <http://www.gnu.org/licenses/>. */ #include <sys/uio.h> -#include <stdio-common/_itoa.h> +#include <_itoa.h> /* This prints out the information in the following form: */ static const char dumpform[] = "\ diff --git a/sysdeps/sparc/sparc32/sparcv9/hp-timing.h b/sysdeps/sparc/sparc32/sparcv9/hp-timing.h index b90bb84152..d0f896da5c 100644 --- a/sysdeps/sparc/sparc32/sparcv9/hp-timing.h +++ b/sysdeps/sparc/sparc32/sparcv9/hp-timing.h @@ -22,7 +22,7 @@ #include <string.h> #include <sys/param.h> -#include <stdio-common/_itoa.h> +#include <_itoa.h> #define HP_TIMING_AVAIL (1) #define HP_TIMING_INLINE (1) diff --git a/sysdeps/sparc/sparc64/hp-timing.h b/sysdeps/sparc/sparc64/hp-timing.h index b68f653fb8..684b846f55 100644 --- a/sysdeps/sparc/sparc64/hp-timing.h +++ b/sysdeps/sparc/sparc64/hp-timing.h @@ -22,7 +22,7 @@ #include <string.h> #include <sys/param.h> -#include <stdio-common/_itoa.h> +#include <_itoa.h> #define HP_TIMING_AVAIL (1) #define HP_TIMING_INLINE (1) diff --git a/sysdeps/unix/sysv/linux/fd_to_filename.h b/sysdeps/unix/sysv/linux/fd_to_filename.h index feefc2b78e..ee939af159 100644 --- a/sysdeps/unix/sysv/linux/fd_to_filename.h +++ b/sysdeps/unix/sysv/linux/fd_to_filename.h @@ -19,7 +19,7 @@ #include <stdlib.h> #include <string.h> #include <sys/stat.h> -#include <stdio-common/_itoa.h> +#include <_itoa.h> static inline const char * fd_to_filename (int fd) diff --git a/sysdeps/unix/sysv/linux/futimes.c b/sysdeps/unix/sysv/linux/futimes.c index cd76f6ffba..913bd105fc 100644 --- a/sysdeps/unix/sysv/linux/futimes.c +++ b/sysdeps/unix/sysv/linux/futimes.c @@ -22,7 +22,7 @@ #include <time.h> #include <utime.h> #include <sys/time.h> -#include <stdio-common/_itoa.h> +#include <_itoa.h> #include <fcntl.h> #include <kernel-features.h> diff --git a/sysdeps/unix/sysv/linux/i386/register-dump.h b/sysdeps/unix/sysv/linux/i386/register-dump.h index d2c5c3fcaf..7f54f67430 100644 --- a/sysdeps/unix/sysv/linux/i386/register-dump.h +++ b/sysdeps/unix/sysv/linux/i386/register-dump.h @@ -18,7 +18,7 @@ <http://www.gnu.org/licenses/>. */ #include <sys/uio.h> -#include <stdio-common/_itoa.h> +#include <_itoa.h> /* We will print the register dump in this format: diff --git a/sysdeps/unix/sysv/linux/ptsname.c b/sysdeps/unix/sysv/linux/ptsname.c index 41edd8f8fe..fb097698fb 100644 --- a/sysdeps/unix/sysv/linux/ptsname.c +++ b/sysdeps/unix/sysv/linux/ptsname.c @@ -26,7 +26,7 @@ #include <termios.h> #include <unistd.h> -#include <stdio-common/_itoa.h> +#include <_itoa.h> /* Check if DEV corresponds to a master pseudo terminal device. */ #define MASTER_P(Dev) \ diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/register-dump.h b/sysdeps/unix/sysv/linux/s390/s390-32/register-dump.h index 0c3b83c24b..1f1a85983e 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-32/register-dump.h +++ b/sysdeps/unix/sysv/linux/s390/s390-32/register-dump.h @@ -18,7 +18,7 @@ <http://www.gnu.org/licenses/>. */ #include <sys/uio.h> -#include <stdio-common/_itoa.h> +#include <_itoa.h> /* We will print the register dump in this format: diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/register-dump.h b/sysdeps/unix/sysv/linux/s390/s390-64/register-dump.h index 0cf89f14ca..671481df75 100644 --- a/sysdeps/unix/sysv/linux/s390/s390-64/register-dump.h +++ b/sysdeps/unix/sysv/linux/s390/s390-64/register-dump.h @@ -18,7 +18,7 @@ <http://www.gnu.org/licenses/>. */ #include <sys/uio.h> -#include <stdio-common/_itoa.h> +#include <_itoa.h> /* We will print the register dump in this format: diff --git a/sysdeps/unix/sysv/linux/sh/sh3/register-dump.h b/sysdeps/unix/sysv/linux/sh/sh3/register-dump.h index 9562882eda..510863e7bf 100644 --- a/sysdeps/unix/sysv/linux/sh/sh3/register-dump.h +++ b/sysdeps/unix/sysv/linux/sh/sh3/register-dump.h @@ -17,7 +17,7 @@ <http://www.gnu.org/licenses/>. */ #include <sys/uio.h> -#include <stdio-common/_itoa.h> +#include <_itoa.h> /* We will print the register dump in this format: diff --git a/sysdeps/unix/sysv/linux/sh/sh4/register-dump.h b/sysdeps/unix/sysv/linux/sh/sh4/register-dump.h index d31ca1f914..f05447c373 100644 --- a/sysdeps/unix/sysv/linux/sh/sh4/register-dump.h +++ b/sysdeps/unix/sysv/linux/sh/sh4/register-dump.h @@ -17,7 +17,7 @@ <http://www.gnu.org/licenses/>. */ #include <sys/uio.h> -#include <stdio-common/_itoa.h> +#include <_itoa.h> /* We will print the register dump in this format: diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/register-dump.h b/sysdeps/unix/sysv/linux/sparc/sparc32/register-dump.h index 0d0cdd6bb2..be6ad74ae1 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/register-dump.h +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/register-dump.h @@ -18,7 +18,7 @@ <http://www.gnu.org/licenses/>. */ #include <sys/uio.h> -#include <stdio-common/_itoa.h> +#include <_itoa.h> /* We will print the register dump in this format: diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/register-dump.h b/sysdeps/unix/sysv/linux/sparc/sparc64/register-dump.h index 8ef6fde2fb..d8e76264f5 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/register-dump.h +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/register-dump.h @@ -18,7 +18,7 @@ <http://www.gnu.org/licenses/>. */ #include <sys/uio.h> -#include <stdio-common/_itoa.h> +#include <_itoa.h> /* We will print the register dump in this format: diff --git a/sysdeps/unix/sysv/linux/ttyname.c b/sysdeps/unix/sysv/linux/ttyname.c index 70b2d51a00..0cfb4740b8 100644 --- a/sysdeps/unix/sysv/linux/ttyname.c +++ b/sysdeps/unix/sysv/linux/ttyname.c @@ -27,7 +27,7 @@ #include <string.h> #include <stdlib.h> -#include <stdio-common/_itoa.h> +#include <_itoa.h> #include <kernel-features.h> #if 0 diff --git a/sysdeps/unix/sysv/linux/ttyname_r.c b/sysdeps/unix/sysv/linux/ttyname_r.c index a12849a777..f097311a15 100644 --- a/sysdeps/unix/sysv/linux/ttyname_r.c +++ b/sysdeps/unix/sysv/linux/ttyname_r.c @@ -27,7 +27,7 @@ #include <string.h> #include <stdlib.h> -#include <stdio-common/_itoa.h> +#include <_itoa.h> #include <kernel-features.h> static int getttyname_r (char *buf, size_t buflen, diff --git a/sysdeps/unix/sysv/linux/x86_64/register-dump.h b/sysdeps/unix/sysv/linux/x86_64/register-dump.h index 83157916d9..3ef8e09b6b 100644 --- a/sysdeps/unix/sysv/linux/x86_64/register-dump.h +++ b/sysdeps/unix/sysv/linux/x86_64/register-dump.h @@ -17,7 +17,7 @@ <http://www.gnu.org/licenses/>. */ #include <sys/uio.h> -#include <stdio-common/_itoa.h> +#include <_itoa.h> /* We will print the register dump in this format: |