Changes in uspace/lib/c/generic/io/asprintf.c [cca2d93b:a35b458] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/io/asprintf.c
rcca2d93b ra35b458 51 51 } 52 52 53 int vprintf_ length(const char *fmt, va_list args)53 int vprintf_size(const char *fmt, va_list args) 54 54 { 55 55 printf_spec_t ps = { … … 62 62 } 63 63 64 int printf_ length(const char *fmt, ...)64 int printf_size(const char *fmt, ...) 65 65 { 66 66 va_list args; 67 67 va_start(args, fmt); 68 int ret = vprintf_ length(fmt, args);68 int ret = vprintf_size(fmt, args); 69 69 va_end(args); 70 70 … … 86 86 va_list args2; 87 87 va_copy(args2, args); 88 int ret = v snprintf(NULL, 0,fmt, args2);88 int ret = vprintf_size(fmt, args2); 89 89 va_end(args2); 90 90 91 91 if (ret > 0) { 92 *strp = malloc( ret+ 1);92 *strp = malloc(STR_BOUNDS(ret) + 1); 93 93 if (*strp == NULL) 94 94 return -1; 95 95 96 vsnprintf(*strp, ret+ 1, fmt, args);96 vsnprintf(*strp, STR_BOUNDS(ret) + 1, fmt, args); 97 97 } 98 98
Note:
See TracChangeset
for help on using the changeset viewer.