aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2019-08-31 20:36:58 -0700
committerGuy Harris <guy@alum.mit.edu>2019-08-31 20:36:58 -0700
commitc805a8e6ac3423fff8541bae9e6dd1be31fc9d28 (patch)
tree5b85e011a5bddf6c0ae0a3a86ece43832273270d
parentec82e5bbd994444c2f10e861dbf3c4d8f0fc7f96 (diff)
Get rid of FILECONF_ISSPACE().
Explicitly check for the characters we care about, to make it clearer what we're doing.
-rw-r--r--rpcapd/fileconf.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/rpcapd/fileconf.c b/rpcapd/fileconf.c
index 08a2da16..76d59334 100644
--- a/rpcapd/fileconf.c
+++ b/rpcapd/fileconf.c
@@ -59,17 +59,14 @@
static char *skipws(char *ptr);
/*
- * Locale-independent version checks for alphabetical, alphanumerical,
- * and white space characters that also can handle being handed a char
- * value that might be negative (and that don't treat FF or VT as white
- * space - they don't belong in our text files as separating space).
+ * Locale-independent version checks for alphabetical and alphanumerical
+ * characters that also can handle being handed a char value that might
+ * be negative.
*/
#define FILECONF_ISALPHA(c) \
(((c) >= 'A' && (c) <= 'Z') || ((c) >= 'a' && (c) <= 'z'))
#define FILECONF_ISALNUM(c) \
(FILECONF_ISALPHA(c) || ((c) >= '0' && (c) <= '9'))
-#define FILECONF_ISSPACE(c) \
- ((c) == ' ' || (c) == '\t' || (c) == '\r' || (c) == '\n')
void fileconf_read(void)
{
@@ -244,12 +241,15 @@ void fileconf_read(void)
ptr += toklen; // skip to the terminator
if (toklen == 0)
{
- if (FILECONF_ISSPACE(*ptr) || *ptr == '#' || *ptr == '\0')
+ if (*ptr == ' ' || *ptr == '\t' ||
+ *ptr == '\r' || *ptr == '\n' ||
+ *ptr == '#' || *ptr == '\0')
{
//
// The first character it saw
// was a whitespace character
- // or a comment character.
+ // or a comment character,
+ // or we ran out of characters.
// This means that there's
// no value.
//
@@ -557,7 +557,7 @@ int fileconf_save(const char *savefile)
//
static char *skipws(char *ptr)
{
- while (FILECONF_ISSPACE(*ptr)) {
+ while (*ptr == ' ' || *ptr == '\t' || *ptr == '\r' || *ptr == '\n') {
if (*ptr == '\r' || *ptr == '\n')
return NULL;
*ptr++ = '\0';