summaryrefslogtreecommitdiff
path: root/sys/lib/libsa
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2014-08-30 13:09:27 +0000
committerchristos <christos@NetBSD.org>2014-08-30 13:09:27 +0000
commit18bfda74a557e1f6698e2eac77fed2edd2c1b7e6 (patch)
tree98f58938212b6fada7fe76b6b3029290468a2953 /sys/lib/libsa
parentf2cb7330065e450fd7e0a052b7c8e34839211cd0 (diff)
remove extra copy of the macro.
Diffstat (limited to 'sys/lib/libsa')
-rw-r--r--sys/lib/libsa/subr_prf.c32
1 files changed, 12 insertions, 20 deletions
diff --git a/sys/lib/libsa/subr_prf.c b/sys/lib/libsa/subr_prf.c
index 125764ca992..6734397ba74 100644
--- a/sys/lib/libsa/subr_prf.c
+++ b/sys/lib/libsa/subr_prf.c
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_prf.c,v 1.25 2014/08/30 12:23:38 tsutsui Exp $ */
+/* $NetBSD: subr_prf.c,v 1.26 2014/08/30 13:09:27 christos Exp $ */
/*-
* Copyright (c) 1993
@@ -79,30 +79,22 @@ const char hexdigits[16] = "0123456789abcdef";
#define ZEROPAD 0x40
#define NEGATIVE 0x80
#define KPRINTN(base) kprintn(put, ul, base, lflag, width)
-#define RADJUSTZEROPAD() \
-do { \
- if ((lflag & (ZEROPAD|LADJUST)) == ZEROPAD) { \
- while (width-- > 0) \
- put('0'); \
- } \
-} while (/*CONSTCOND*/0)
-#define LADJUSTPAD() \
+#define LADJUSTPAD(c) \
do { \
if (lflag & LADJUST) { \
while (width-- > 0) \
- put(' '); \
+ put(c); \
} \
} while (/*CONSTCOND*/0)
-#define RADJUSTPAD() \
+#define RADJUSTPAD(c) \
do { \
if ((lflag & (ZEROPAD|LADJUST)) == 0) { \
while (width-- > 0) \
- put(' '); \
+ put(c); \
} \
} while (/*CONSTCOND*/0)
#else /* LIBSA_PRINTF_WIDTH_SUPPORT */
#define KPRINTN(base) kprintn(put, ul, base)
-#define RADJUSTZEROPAD() /**/
#define LADJUSTPAD() /**/
#define RADJUSTPAD() /**/
#endif /* LIBSA_PRINTF_WIDTH_SUPPORT */
@@ -235,9 +227,9 @@ reswitch:
#ifdef LIBSA_PRINTF_WIDTH_SUPPORT
--width;
#endif
- RADJUSTPAD();
+ RADJUSTPAD(' ');
put(ch & 0xFF);
- LADJUSTPAD();
+ LADJUSTPAD(' ');
break;
case 's':
p = va_arg(ap, char *);
@@ -246,10 +238,10 @@ reswitch:
continue;
width -= q - p;
#endif
- RADJUSTPAD();
+ RADJUSTPAD(' ');
while ((ch = (unsigned char)*p++))
put(ch);
- LADJUSTPAD();
+ LADJUSTPAD(' ');
break;
case 'd':
ul =
@@ -332,10 +324,10 @@ kprintn(void (*put)(int), UINTMAX_T ul, int base)
put(*--p);
}
#endif
- RADJUSTPAD();
- RADJUSTZEROPAD();
+ RADJUSTPAD(' ');
+ RADJUSTPAD('0');
do {
put(*--p);
} while (p > buf);
- LADJUSTPAD();
+ LADJUSTPAD(' ');
}