Skip to content

Commit

Permalink
lib/vsprintf.c: consume 'p' in format_decode
Browse files Browse the repository at this point in the history
It seems a little simpler to consume the p from a %p specifier in
format_decode, just as it is done for the surrounding %c, %s and %% cases.

While there, delete a redundant and misplaced comment.

Signed-off-by: Rasmus Villemoes <[email protected]>
Cc: Jiri Kosina <[email protected]>
Cc: Randy Dunlap <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Villemoes authored and torvalds committed Feb 13, 2015
1 parent 205bd3d commit ffbfed0
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/vsprintf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1604,8 +1604,7 @@ int format_decode(const char *fmt, struct printf_spec *spec)

case 'p':
spec->type = FORMAT_TYPE_PTR;
return fmt - start;
/* skip alnum */
return ++fmt - start;

case '%':
spec->type = FORMAT_TYPE_PERCENT_CHAR;
Expand Down Expand Up @@ -1794,7 +1793,7 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
break;

case FORMAT_TYPE_PTR:
str = pointer(fmt+1, str, end, va_arg(args, void *),
str = pointer(fmt, str, end, va_arg(args, void *),
spec);
while (isalnum(*fmt))
fmt++;
Expand Down Expand Up @@ -2232,7 +2231,7 @@ int bstr_printf(char *buf, size_t size, const char *fmt, const u32 *bin_buf)
}

case FORMAT_TYPE_PTR:
str = pointer(fmt+1, str, end, get_arg(void *), spec);
str = pointer(fmt, str, end, get_arg(void *), spec);
while (isalnum(*fmt))
fmt++;
break;
Expand Down

0 comments on commit ffbfed0

Please sign in to comment.