summaryrefslogtreecommitdiff
path: root/firmware/libc/sprintf.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/libc/sprintf.c')
-rw-r--r--firmware/libc/sprintf.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/firmware/libc/sprintf.c b/firmware/libc/sprintf.c
index b02f5a2fae..18e2ce6fd2 100644
--- a/firmware/libc/sprintf.c
+++ b/firmware/libc/sprintf.c
@@ -57,7 +57,6 @@ static int sprfunc(void *ptr, unsigned char letter)
57 57
58int snprintf(char *buf, size_t size, const char *fmt, ...) 58int snprintf(char *buf, size_t size, const char *fmt, ...)
59{ 59{
60 bool ok;
61 va_list ap; 60 va_list ap;
62 struct for_snprintf pr; 61 struct for_snprintf pr;
63 62
@@ -66,7 +65,7 @@ int snprintf(char *buf, size_t size, const char *fmt, ...)
66 pr.max = size; 65 pr.max = size;
67 66
68 va_start(ap, fmt); 67 va_start(ap, fmt);
69 ok = format(sprfunc, &pr, fmt, ap); 68 format(sprfunc, &pr, fmt, ap);
70 va_end(ap); 69 va_end(ap);
71 70
72 /* make sure it ends with a trailing zero */ 71 /* make sure it ends with a trailing zero */
@@ -77,14 +76,13 @@ int snprintf(char *buf, size_t size, const char *fmt, ...)
77 76
78int vsnprintf(char *buf, size_t size, const char *fmt, va_list ap) 77int vsnprintf(char *buf, size_t size, const char *fmt, va_list ap)
79{ 78{
80 bool ok;
81 struct for_snprintf pr; 79 struct for_snprintf pr;
82 80
83 pr.ptr = (unsigned char *)buf; 81 pr.ptr = (unsigned char *)buf;
84 pr.bytes = 0; 82 pr.bytes = 0;
85 pr.max = size; 83 pr.max = size;
86 84
87 ok = format(sprfunc, &pr, fmt, ap); 85 format(sprfunc, &pr, fmt, ap);
88 86
89 /* make sure it ends with a trailing zero */ 87 /* make sure it ends with a trailing zero */
90 pr.ptr[(pr.bytes < pr.max) ? 0 : -1] = '\0'; 88 pr.ptr[(pr.bytes < pr.max) ? 0 : -1] = '\0';