summaryrefslogtreecommitdiff
path: root/stdio-common/_itoa.h
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-10-29 15:17:25 +0000
committerUlrich Drepper <drepper@redhat.com>1998-10-29 15:17:25 +0000
commitc5e340c71ba6f4563ca5fa245baa82b6363ddb2e (patch)
tree3ff655dfee624df411e1f3ebc062181fc0f3f338 /stdio-common/_itoa.h
parent05e951cd1ae7917ce25ec96cc17ebcbf401e345c (diff)
Update.
1998-10-29 Ulrich Drepper <drepper@cygnus.com> * sysdeps/unix/sysv/linux/ttyname_r.c (ttyname_r): Try reading /prof/self/fd/FD first. * sysdeps/unix/sysv/linux/ttyname.c (ttyname): Likewise. * stdio-common/_itoa.h (_fitoa_word): New inline function. Write formatted number starting at given position and return pointer to following byte. (_fitoa): Likewise, for long long.
Diffstat (limited to 'stdio-common/_itoa.h')
-rw-r--r--stdio-common/_itoa.h22
1 files changed, 21 insertions, 1 deletions
diff --git a/stdio-common/_itoa.h b/stdio-common/_itoa.h
index 2794912c91..976636907d 100644
--- a/stdio-common/_itoa.h
+++ b/stdio-common/_itoa.h
@@ -1,5 +1,5 @@
/* Internal function for converting integers to ASCII.
- Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+ Copyright (C) 1994, 1995, 1996, 1997, 1998 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
@@ -57,4 +57,24 @@ _itoa_word (unsigned long value, char *buflim,
return bp;
}
+static inline char * __attribute__ ((unused))
+_fitoa_word (unsigned long value, char *buf, unsigned int base, int upper_case)
+{
+ char tmpbuf[sizeof (value) * 4]; /* Worst case length: base 2. */
+ char *cp = _itoa_word (value, tmpbuf + sizeof (value) * 4, base, upper_case);
+ while (cp < tmpbuf + sizeof (value) * 4)
+ *buf++ = *cp++;
+ return buf;
+}
+
+static inline char * __attribute__ ((unused))
+_fitoa (unsigned long long value, char *buf, unsigned int base, int upper_case)
+{
+ char tmpbuf[sizeof (value) * 4]; /* Worst case length: base 2. */
+ char *cp = _itoa (value, tmpbuf + sizeof (value) * 4, base, upper_case);
+ while (cp < tmpbuf + sizeof (value) * 4)
+ *buf++ = *cp++;
+ return buf;
+}
+
#endif /* itoa.h */