From 2e0d25c2b20f95865d8f6ea5531da74a32f3444d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Courr=C3=A8ges-Anglas?= Date: Sun, 7 Apr 2013 03:23:50 +0200 Subject: 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. --- src/main.c | 18 +++++++++--------- 1 file 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; } -- cgit v1.2.3