summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2016-09-07 11:25:18 +0300
committerAndrew Boie <andrew.p.boie@intel.com>2016-09-07 15:10:57 +0000
commit65a8e3c1c9e99bc952440fb7194a30dba6ed65a4 (patch)
treeb31e23581be7c186c80e444680cbc3ad2a7a66c3 /lib
parent92de81c36d2451d9e8f18fd383b052a52d5de709 (diff)
libc: printf: Add support for 'z' length specifier
The 'z' length specifier is the appropriate one to be used with size_t (%zu) and ssize_t (%zd) types. Having support for this in our libc means that we can utilize the compiler format string checks (__printf_like) without getting warnings of incorrect format specifiers for size_t and ssize_t variables. Change-Id: I73fec0145692e0a59934cab548caf24c1c16a3df Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/minimal/source/stdout/prf.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/libc/minimal/source/stdout/prf.c b/lib/libc/minimal/source/stdout/prf.c
index 6e6d829c1..f394133d2 100644
--- a/lib/libc/minimal/source/stdout/prf.c
+++ b/lib/libc/minimal/source/stdout/prf.c
@@ -615,10 +615,11 @@ int _prf(int (*func)(), void *dest, char *format, va_list vargs)
* h: short
* l: long
* L: long double
+ * z: size_t or ssize_t
* No further special processing is done for them.
*/
- if (strchr("hlL", c) != NULL) {
+ if (strchr("hlLz", c) != NULL) {
i = c;
c = *format++;
switch (i) {
@@ -636,6 +637,12 @@ int _prf(int (*func)(), void *dest, char *format, va_list vargs)
if (strchr("eEfgG", c) == NULL)
break;
break;
+
+ case 'z':
+ if (strchr("diouxX", c) == NULL)
+ break;
+ break;
+
}
}