Skip to content
Snippets Groups Projects
Commit 602512f9 authored by Moe Jette's avatar Moe Jette
Browse files

Make configuration file integer value compare to "INFINITE" be case insensitive.

Convert xmalloc()/strcpy() to xstrdup().
parent d365d95c
No related branches found
No related tags found
No related merge requests found
...@@ -39,6 +39,8 @@ ...@@ -39,6 +39,8 @@
#include "src/common/log.h" #include "src/common/log.h"
#include "src/common/parse_spec.h" #include "src/common/parse_spec.h"
#include "src/common/xmalloc.h" #include "src/common/xmalloc.h"
#include "src/common/xstring.h"
#define BUF_SIZE 1024 #define BUF_SIZE 1024
#define SEPCHARS " \n\t" #define SEPCHARS " \n\t"
...@@ -175,7 +177,7 @@ _load_integer (int *destination, char *keyword, char *in_line) ...@@ -175,7 +177,7 @@ _load_integer (int *destination, char *keyword, char *in_line)
str_ptr2 = (char *) strtok_r (scratch, SEPCHARS, str_ptr2 = (char *) strtok_r (scratch, SEPCHARS,
&str_ptr3); &str_ptr3);
str_len2 = strlen (str_ptr2); str_len2 = strlen (str_ptr2);
if (strcmp (str_ptr2, "UNLIMITED") == 0) if (strcasecmp (str_ptr2, "UNLIMITED") == 0)
*destination = -1; *destination = -1;
else if ((str_ptr2[0] >= '0') && else if ((str_ptr2[0] >= '0') &&
(str_ptr2[0] <= '9')) { (str_ptr2[0] <= '9')) {
...@@ -232,7 +234,7 @@ _load_long (long *destination, char *keyword, char *in_line) ...@@ -232,7 +234,7 @@ _load_long (long *destination, char *keyword, char *in_line)
str_ptr2 = (char *) strtok_r (scratch, SEPCHARS, str_ptr2 = (char *) strtok_r (scratch, SEPCHARS,
&str_ptr3); &str_ptr3);
str_len2 = strlen (str_ptr2); str_len2 = strlen (str_ptr2);
if (strcmp (str_ptr2, "UNLIMITED") == 0) if (strcasecmp (str_ptr2, "UNLIMITED") == 0)
*destination = -1L; *destination = -1L;
else if ((str_ptr2[0] >= '0') && else if ((str_ptr2[0] >= '0') &&
(str_ptr2[0] <= '9')) { (str_ptr2[0] <= '9')) {
...@@ -293,8 +295,7 @@ load_string (char **destination, char *keyword, char *in_line) ...@@ -293,8 +295,7 @@ load_string (char **destination, char *keyword, char *in_line)
return EINVAL; return EINVAL;
} }
xfree (destination[0]); xfree (destination[0]);
destination[0] = (char *) xmalloc (str_len2 + 1); destination[0] = xstrdup(str_ptr2);
strcpy (destination[0], str_ptr2);
for (i = 0; i < (str_len1 + str_len2 + quoted); i++) for (i = 0; i < (str_len1 + str_len2 + quoted); i++)
str_ptr1[i] = ' '; str_ptr1[i] = ' ';
if (quoted && (str_ptr1[i] == '"')) if (quoted && (str_ptr1[i] == '"'))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment