diff options
author | Jérémie Courrèges-Anglas <jca@wxcvbn.org> | 2013-04-07 03:23:50 +0200 |
---|---|---|
committer | Jérémie Courrèges-Anglas <jca@wxcvbn.org> | 2013-04-07 03:48:00 +0200 |
commit | 2e0d25c2b20f95865d8f6ea5531da74a32f3444d (patch) | |
tree | 5799aa0f54e505065f2db4905874af791d2481fa /src | |
parent | c65e1dc8d80c023e1d0af957532fe23e2628a143 (diff) | |
download | ratpoison-2e0d25c2b20f95865d8f6ea5531da74a32f3444d.zip |
In strtok_ws() use "last", not "pointer" for the static variable
* since X11/Xdefs.h may define it too. Found by -Wshadow.
Bonus: "last" carries more meaning.
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -169,26 +169,26 @@ char * strtok_ws (char *s) { char *nonws; - static char *pointer = NULL; + static char *last = NULL; if (s) - pointer = s; + last = s; /* skip to first non-whitespace char. */ - while (*pointer && isspace (*pointer)) pointer++; + while (*last && isspace (*last)) last++; /* If we reached the end of the string here then there is no more data. */ - if (*pointer == 0) + if (*last == '\0') return NULL; /* Now skip to the end of the data. */ - nonws = pointer; - while (*pointer && !isspace (*pointer)) pointer++; - if (*pointer) + nonws = last; + while (*last && !isspace (*last)) last++; + if (*last) { - *pointer = 0; - pointer++; + *last = '\0'; + last++; } return nonws; } |