break;
case PRE_VALUE:
- if (strchr(newline, c) || strchr(COMMENTS, c)) {
+ if (strchr(newline, c)) {
state = PRE_KEY;
key[n_key] = 0;
value[n_value] = 0;
/* strip trailing whitespace from key */
- while(strchr(WHITESPACE, key[--n_key]))
+ while(n_key && strchr(WHITESPACE, key[--n_key]))
key[n_key]=0;
r = push(key, value, userdata);
case VALUE:
if (strchr(newline, c)) {
state = PRE_KEY;
+
key[n_key] = 0;
if (value)
value[last_whitespace] = 0;
/* strip trailing whitespace from key */
- while(strchr(WHITESPACE, key[--n_key]))
+ while(n_key && strchr(WHITESPACE, key[--n_key]))
key[n_key]=0;
r = push(key, value, userdata);
value[n_value] = 0;
/* strip trailing whitespace from key */
- while(strchr(WHITESPACE, key[--n_key]))
+ while(n_key && strchr(WHITESPACE, key[--n_key]))
key[n_key]=0;
r = push(key, value, userdata);