From 602512f99db64e0d1f07a3635736c99e4bf5d402 Mon Sep 17 00:00:00 2001 From: Moe Jette <jette1@llnl.gov> Date: Tue, 15 Jul 2003 02:20:38 +0000 Subject: [PATCH] Make configuration file integer value compare to "INFINITE" be case insensitive. Convert xmalloc()/strcpy() to xstrdup(). --- src/common/parse_spec.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/common/parse_spec.c b/src/common/parse_spec.c index 3340cd1cda6..122efed0751 100644 --- a/src/common/parse_spec.c +++ b/src/common/parse_spec.c @@ -39,6 +39,8 @@ #include "src/common/log.h" #include "src/common/parse_spec.h" #include "src/common/xmalloc.h" +#include "src/common/xstring.h" + #define BUF_SIZE 1024 #define SEPCHARS " \n\t" @@ -175,7 +177,7 @@ _load_integer (int *destination, char *keyword, char *in_line) str_ptr2 = (char *) strtok_r (scratch, SEPCHARS, &str_ptr3); str_len2 = strlen (str_ptr2); - if (strcmp (str_ptr2, "UNLIMITED") == 0) + if (strcasecmp (str_ptr2, "UNLIMITED") == 0) *destination = -1; else if ((str_ptr2[0] >= '0') && (str_ptr2[0] <= '9')) { @@ -232,7 +234,7 @@ _load_long (long *destination, char *keyword, char *in_line) str_ptr2 = (char *) strtok_r (scratch, SEPCHARS, &str_ptr3); str_len2 = strlen (str_ptr2); - if (strcmp (str_ptr2, "UNLIMITED") == 0) + if (strcasecmp (str_ptr2, "UNLIMITED") == 0) *destination = -1L; else if ((str_ptr2[0] >= '0') && (str_ptr2[0] <= '9')) { @@ -293,8 +295,7 @@ load_string (char **destination, char *keyword, char *in_line) return EINVAL; } xfree (destination[0]); - destination[0] = (char *) xmalloc (str_len2 + 1); - strcpy (destination[0], str_ptr2); + destination[0] = xstrdup(str_ptr2); for (i = 0; i < (str_len1 + str_len2 + quoted); i++) str_ptr1[i] = ' '; if (quoted && (str_ptr1[i] == '"')) -- GitLab