about summary refs log tree commit diff
path: root/stdio-common/_itoa.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-06-06 06:06:02 +0000
committerUlrich Drepper <drepper@redhat.com>2004-06-06 06:06:02 +0000
commit40c38b6c9d4b49d509630dccb55cf529b3da3d89 (patch)
treedc727938810ecd6787700960f57ebd6c090ff42f /stdio-common/_itoa.c
parentd4c4ee1ed59571c3214b546fbbdbab2beb97860c (diff)
downloadglibc-40c38b6c9d4b49d509630dccb55cf529b3da3d89.tar.gz
glibc-40c38b6c9d4b49d509630dccb55cf529b3da3d89.tar.xz
glibc-40c38b6c9d4b49d509630dccb55cf529b3da3d89.zip
Update.
2004-06-05  Ulrich Drepper  <drepper@redhat.com>

	* stdio-common/_itoa.h: Don't expand _itoa inline for libc.
	* stdio-common/_itoa.c: Add _itoa implementation.

	* nscd/nscd_gethst_r.c (__nscd_open_socket): Change implementation
	to also send request.  Add parameter to allow this.
	Change callers.
	* nscd/nscd_getgr_r.c: Change __nscd_open_socket caller.
	* nscd/nscd_getpw_r.c: Likewise.
	* nscd/nscd-client.h: Change __nscd_open_socket prototype.
Diffstat (limited to 'stdio-common/_itoa.c')
-rw-r--r--stdio-common/_itoa.c38
1 files changed, 37 insertions, 1 deletions
diff --git a/stdio-common/_itoa.c b/stdio-common/_itoa.c
index e39d88df7f..f61b23fceb 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, 2002, 2003
+   Copyright (C) 1994, 1995, 1996, 1999, 2000, 2002, 2003, 2004
    Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Torbjorn Granlund <tege@matematik.su.se>
@@ -166,6 +166,42 @@ extern const char _itoa_upper_digits_internal[] attribute_hidden;
 
 
 char *
+_itoa_word (unsigned long value, char *buflim,
+	    unsigned int base, int upper_case)
+{
+  const char *digits = (upper_case
+#if !defined NOT_IN_libc || 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
+
+
+char *
 _itoa (value, buflim, base, upper_case)
      unsigned long long int value;
      char *buflim;