Commit cee5c346 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

More error handling in parser.

Now that the parser can be invoked at runtime, we need to be extra
careful with error handling.
parent 18c2172b
......@@ -103,6 +103,8 @@ getword(int c, char **token_r, gnc_t gnc, void *closure)
} while(c != ' ' && c != '\t' && c != '\r' && c != '\n' && c != '#' && c >= 0);
buf[i] = '\0';
*token_r = strdup(buf);
if(*token_r == NULL)
return -2;
return c;
}
......@@ -140,6 +142,8 @@ getstring(int c, char **token_r, gnc_t gnc, void *closure)
buf[i] = '\0';
*token_r = strdup(buf);
if(*token_r == NULL)
return -2;
return c;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment