summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJérémie Courrèges-Anglas <jca@wxcvbn.org>2013-04-07 03:23:50 +0200
committerJérémie Courrèges-Anglas <jca@wxcvbn.org>2013-04-07 03:48:00 +0200
commit2e0d25c2b20f95865d8f6ea5531da74a32f3444d (patch)
tree5799aa0f54e505065f2db4905874af791d2481fa
parentc65e1dc8d80c023e1d0af957532fe23e2628a143 (diff)
downloadratpoison-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.
-rw-r--r--src/main.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/main.c b/src/main.c
index 44cb2e3..eb2e804 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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;
}