]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
Move simple_itoa to vsprintf
authorSimon Glass <sjg@chromium.org>
Fri, 21 Oct 2011 18:51:33 +0000 (18:51 +0000)
committerWolfgang Denk <wd@denx.de>
Wed, 26 Oct 2011 19:32:15 +0000 (21:32 +0200)
This function is generally useful and shouldn't hide away in hush. It
has been moved as is.

Signed-off-by: Simon Glass <sjg@chromium.org>
common/hush.c
include/common.h
lib/vsprintf.c

index 940889b89864b7adbbfe1bd3e6803a423c6e43d0..2495a6d5927d6033fe860e724447769fae731ad7 100644 (file)
@@ -17,7 +17,6 @@
  *      Erik W. Troan, which they placed in the public domain.  I don't know
  *      how much of the Johnson/Troan code has survived the repeated rewrites.
  * Other credits:
- *      simple_itoa() was lifted from boa-0.93.15
  *      b_addchr() derived from similar w_addchar function in glibc-2.2
  *      setup_redirect(), redirect_opt_num(), and big chunks of main()
  *        and many builtins derived from contributions by Erik Andersen
@@ -922,20 +921,6 @@ static int b_addqchr(o_string *o, int ch, int quote)
        return b_addchr(o, ch);
 }
 
-/* belongs in utility.c */
-char *simple_itoa(unsigned int i)
-{
-       /* 21 digits plus null terminator, good for 64-bit or smaller ints */
-       static char local[22];
-       char *p = &local[21];
-       *p-- = '\0';
-       do {
-               *p-- = '0' + i % 10;
-               i /= 10;
-       } while (i > 0);
-       return p + 1;
-}
-
 #ifndef __U_BOOT__
 static int b_adduint(o_string *o, unsigned int i)
 {
index 13575272b4baa6edaae8aa1418085199662a39a5..8b719eac94cfb7289835e12d360d42e82fd712ec 100644 (file)
@@ -723,6 +723,7 @@ void        panic(const char *fmt, ...)
 int    sprintf(char * buf, const char *fmt, ...)
                __attribute__ ((format (__printf__, 2, 3)));
 int    vsprintf(char *buf, const char *fmt, va_list args);
+char *simple_itoa(ulong i);
 
 /* lib/strmhz.c */
 char * strmhz(char *buf, unsigned long hz);
index 79dead3996eb14bc82f40a68966be743e0743216..e497a8686ed321acf5119e290fd32b0fd74ed61d 100644 (file)
@@ -7,6 +7,8 @@
 /* vsprintf.c -- Lars Wirzenius & Linus Torvalds. */
 /*
  * Wirzenius wrote this portably, Torvalds fucked it up :-)
+ *
+ * from hush: simple_itoa() was lifted from boa-0.93.15
  */
 
 #include <stdarg.h>
@@ -738,3 +740,17 @@ void __assert_fail(const char *assertion, const char *file, unsigned line,
        panic("%s:%u: %s: Assertion `%s' failed.", file, line, function,
              assertion);
 }
+
+char *simple_itoa(ulong i)
+{
+       /* 21 digits plus null terminator, good for 64-bit or smaller ints */
+       static char local[22];
+       char *p = &local[21];
+
+       *p-- = '\0';
+       do {
+               *p-- = '0' + i % 10;
+               i /= 10;
+       } while (i > 0);
+       return p + 1;
+}