Revert "Move simple_itoa to vsprintf"
authorGrazvydas Ignotas <notasas@gmail.com>
Tue, 27 Dec 2011 14:19:30 +0000 (16:19 +0200)
committerGrazvydas Ignotas <notasas@gmail.com>
Tue, 27 Dec 2011 14:42:53 +0000 (16:42 +0200)
This reverts commit 3cce8a5496452285e1828984ad3945417205cfc3.

Fixes build as this triggers CSL 2009q1-203 bug somehow.
CSL 2011.03-41 doesn't have this bug but u-boot built by it
won't boot .27 kernel due to unknown reasons.

common/hush.c
include/common.h
lib/vsprintf.c

index e8e24d7..d2e7259 100644 (file)
@@ -17,6 +17,7 @@
  *      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
@@ -921,6 +922,20 @@ 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 5cfdd76..4b2ac2a 100644 (file)
@@ -742,7 +742,6 @@ 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 e497a86..79dead3 100644 (file)
@@ -7,8 +7,6 @@
 /* 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>
@@ -740,17 +738,3 @@ 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;
-}