diff options
| author | Michael Kerrisk <mtk.manpages@gmail.com> | 2013-02-28 14:24:25 +0100 |
|---|---|---|
| committer | Michael Kerrisk <mtk.manpages@gmail.com> | 2013-02-28 15:00:09 +0100 |
| commit | ca38ce4c3c38c86356263b96248eb2629bc6a393 (patch) | |
| tree | d60774a918437b8da791d419977f722b73cecfbb | |
| parent | 753f3bace98aebedf15355e68505b13b9708f8d0 (diff) | |
| download | man-pages-ca38ce4c3c38c86356263b96248eb2629bc6a393.tar.gz | |
printf.3: Minor improvements to example code
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
| -rw-r--r-- | man3/printf.3 | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/man3/printf.3 b/man3/printf.3 index 09f8e78b68..d666702428 100644 --- a/man3/printf.3 +++ b/man3/printf.3 @@ -1038,7 +1038,7 @@ char * make_message(const char *fmt, ...) { int n; - int size = 100; /* Guess we need no more than 100 bytes. */ + int size = 100; /* Guess we need no more than 100 bytes */ char *p, *np; va_list ap; @@ -1047,7 +1047,7 @@ make_message(const char *fmt, ...) while (1) { - /* Try to print in the allocated space. */ + /* Try to print in the allocated space */ va_start(ap, fmt); n = vsnprintf(p, size, fmt, ap); @@ -1058,15 +1058,14 @@ make_message(const char *fmt, ...) if (n < 0) return NULL; - /* If that worked, return the string. */ + /* If that worked, return the string */ if (n < size) return p; - /* Else try again with more space. */ + /* Else try again with more space */ - else - size = n+1; /* precisely what is needed */ + size = n + 1; /* Precisely what is needed */ if ((np = realloc (p, size)) == NULL) { |
