Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 176370
b: refs/heads/master
c: c5484d7
h: refs/heads/master
v: v3
  • Loading branch information
André Goddard Rosa authored and Linus Torvalds committed Dec 15, 2009
1 parent 935074a commit 9b5db34
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d4be151b2180fbbc6729dfaa16280d150e3fab1f
refs/heads/master: c5484d7c0a533de6198cb474097e33b174f9c565
19 changes: 11 additions & 8 deletions trunk/lib/vsprintf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1786,6 +1786,13 @@ EXPORT_SYMBOL_GPL(bprintf);

#endif /* CONFIG_BINARY_PRINTF */

static noinline char *skip_space(const char *str)
{
while (isspace(*str))
++str;
return (char *)str;
}

/**
* vsscanf - Unformat a buffer into a list of arguments
* @buf: input buffer
Expand All @@ -1807,10 +1814,8 @@ int vsscanf(const char *buf, const char *fmt, va_list args)
* white space, including none, in the input.
*/
if (isspace(*fmt)) {
while (isspace(*fmt))
++fmt;
while (isspace(*str))
++str;
fmt = skip_space(fmt);
str = skip_space(str);
}

/* anything that is not a conversion must match exactly */
Expand Down Expand Up @@ -1880,8 +1885,7 @@ int vsscanf(const char *buf, const char *fmt, va_list args)
if (field_width == -1)
field_width = INT_MAX;
/* first, skip leading white space in buffer */
while (isspace(*str))
str++;
str = skip_space(str);

/* now copy until next white space */
while (*str && !isspace(*str) && field_width--)
Expand Down Expand Up @@ -1923,8 +1927,7 @@ int vsscanf(const char *buf, const char *fmt, va_list args)
/* have some sort of integer conversion.
* first, skip white space in buffer.
*/
while (isspace(*str))
str++;
str = skip_space(str);

digit = *str;
if (is_sign && digit == '-')
Expand Down

0 comments on commit 9b5db34

Please sign in to comment.