Changeset ab936440 in mainline for uspace/lib/c/generic/io/asprintf.c
- Timestamp:
- 2019-02-12T20:42:42Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f31ca47
- Parents:
- 7f7817a9 (diff), 4805495 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - git-author:
- Matthieu Riolo <matthieu.riolo@…> (2019-02-12 20:26:18)
- git-committer:
- Matthieu Riolo <matthieu.riolo@…> (2019-02-12 20:42:42)
- File:
-
- 1 edited
-
uspace/lib/c/generic/io/asprintf.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/io/asprintf.c
r7f7817a9 rab936440 51 51 } 52 52 53 int vprintf_ size(const char *fmt, va_list args)53 int vprintf_length(const char *fmt, va_list args) 54 54 { 55 55 printf_spec_t ps = { … … 62 62 } 63 63 64 int printf_ size(const char *fmt, ...)64 int printf_length(const char *fmt, ...) 65 65 { 66 66 va_list args; 67 67 va_start(args, fmt); 68 int ret = vprintf_ size(fmt, args);68 int ret = vprintf_length(fmt, args); 69 69 va_end(args); 70 70 … … 86 86 va_list args2; 87 87 va_copy(args2, args); 88 int ret = v printf_size(fmt, args2);88 int ret = vsnprintf(NULL, 0, fmt, args2); 89 89 va_end(args2); 90 90 91 91 if (ret > 0) { 92 *strp = malloc( STR_BOUNDS(ret)+ 1);92 *strp = malloc(ret + 1); 93 93 if (*strp == NULL) 94 94 return -1; 95 95 96 vsnprintf(*strp, STR_BOUNDS(ret)+ 1, fmt, args);96 vsnprintf(*strp, ret + 1, fmt, args); 97 97 } 98 98
Note:
See TracChangeset
for help on using the changeset viewer.
