summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2016-05-14 14:02:52 -0600
committerSimon Glass <sjg@chromium.org>2016-05-26 20:48:44 -0600
commit1fb67608b309bd7f49842fbdfb1dc2b18a250965 (patch)
tree627c43b89177989306985f6045823f7da0e8e8db /lib
parentd0375f3cc55ce740836f9ba6fe081ed0fdc19a3c (diff)
downloadblackbird-obmc-uboot-1fb67608b309bd7f49842fbdfb1dc2b18a250965.tar.gz
blackbird-obmc-uboot-1fb67608b309bd7f49842fbdfb1dc2b18a250965.zip
tiny-printf: Tidy up a few nits
- Rename 'w' to 'width' to make it more obvious what it is used for - Use bool and int types instead of char to avoid register-masking on 32-bit machines Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/tiny-printf.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/tiny-printf.c b/lib/tiny-printf.c
index a06abed495..fbd5368c0b 100644
--- a/lib/tiny-printf.c
+++ b/lib/tiny-printf.c
@@ -52,8 +52,8 @@ int vprintf(const char *fmt, va_list va)
if (ch != '%') {
putc(ch);
} else {
- char lz = 0;
- char w = 0;
+ bool lz = false;
+ int width = 0;
ch = *(fmt++);
if (ch == '0') {
@@ -62,9 +62,9 @@ int vprintf(const char *fmt, va_list va)
}
if (ch >= '0' && ch <= '9') {
- w = 0;
+ width = 0;
while (ch >= '0' && ch <= '9') {
- w = (w * 10) + ch - '0';
+ width = (width * 10) + ch - '0';
ch = *fmt++;
}
}
@@ -73,7 +73,7 @@ int vprintf(const char *fmt, va_list va)
zs = 0;
switch (ch) {
- case 0:
+ case '\0':
goto abort;
case 'u':
case 'd':
@@ -112,9 +112,9 @@ int vprintf(const char *fmt, va_list va)
*bf = 0;
bf = p;
- while (*bf++ && w > 0)
- w--;
- while (w-- > 0)
+ while (*bf++ && width > 0)
+ width--;
+ while (width-- > 0)
putc(lz ? '0' : ' ');
if (p) {
while ((ch = *p++))
OpenPOWER on IntegriCloud