aboutsummaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorStewart Smith <stewart@linux.vnet.ibm.com>2014-11-26 11:29:57 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2014-11-26 11:29:57 +1100
commitcaf25fa378de07eb271be3ef6a63719b5c116875 (patch)
tree65cfb707be0b336f062a3fbb960ec15289dfb27c /libc
parentca70500ab7510cd7beb1d84b386e4b640c8e19a2 (diff)
parentf469cb35866a1499ad3855e6753718bd077a816a (diff)
downloadskiboot-caf25fa378de07eb271be3ef6a63719b5c116875.zip
skiboot-caf25fa378de07eb271be3ef6a63719b5c116875.tar.gz
skiboot-caf25fa378de07eb271be3ef6a63719b5c116875.tar.bz2
Merge branch 'update-2.1.1.1'
Diffstat (limited to 'libc')
-rw-r--r--libc/stdio/vsnprintf.c18
-rw-r--r--libc/test/run-time.c1
2 files changed, 10 insertions, 9 deletions
diff --git a/libc/stdio/vsnprintf.c b/libc/stdio/vsnprintf.c
index d1cd4e3..b2f0b94 100644
--- a/libc/stdio/vsnprintf.c
+++ b/libc/stdio/vsnprintf.c
@@ -29,22 +29,22 @@ print_itoa(char **buffer, unsigned long value, unsigned short base, bool upper)
{
const char zeichen[] = {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'};
char c;
+ int i = 0;
+ char tmp[16];
if(base <= 2 || base > 16)
return 0;
- if (value < base) {
- c = zeichen[value];
- if (upper)
- c = toupper(c);
- **buffer = c;
- *buffer += 1;
- } else {
- print_itoa(buffer, value / base, base, upper);
+ do {
c = zeichen[value % base];
if (upper)
c = toupper(c);
- **buffer = c;
+ tmp[i++] = c;
+ value /= base;
+ } while(value);
+
+ while (i--) {
+ **buffer = tmp[i];
*buffer += 1;
}
diff --git a/libc/test/run-time.c b/libc/test/run-time.c
index b0a221d..0f377b5 100644
--- a/libc/test/run-time.c
+++ b/libc/test/run-time.c
@@ -1,6 +1,7 @@
#include "/usr/include/assert.h"
#include <stdio.h>
#include <time.h>
+#include <stdint.h>
#include "../time.c"