Compare commits

..

No commits in common. "a741f3c473c30ca1fb398801a88259eaab807aea" and "b025e81c54d32cf82cf63572f7aa5532c8f48375" have entirely different histories.

1 changed files with 6 additions and 10 deletions

View File

@ -78,11 +78,11 @@ int nextnw(FILE* file) {
} }
static static
int _parse_key(FILE* file, char* out) { void _parse_key(FILE* file, char* out) {
char c; char c;
do { do {
c = fgetc(file); c = fgetc(file);
if(c == ':' || c == ';') { if(c == ':') {
*out = '\0'; *out = '\0';
} else if(c == '#') { } else if(c == '#') {
freadto(file, '\n'); freadto(file, '\n');
@ -90,9 +90,7 @@ int _parse_key(FILE* file, char* out) {
*out = c; *out = c;
++out; ++out;
} }
} while(c != ':' && c != ';'); } while(c != ':');
return c == ':';
} }
static static
@ -139,11 +137,9 @@ void _parse_config(FILE* file) {
char begin = nextnw(file); char begin = nextnw(file);
ungetc(begin, file); ungetc(begin, file);
int has_args = _parse_key(file, key); _parse_key(file, key);
ungetc(nextnw(file), file); ungetc(nextnw(file), file);
if(has_args) {
_parse_value(file, value, &argc, argv); _parse_value(file, value, &argc, argv);
}
struct type_handler_t* handler = _find_handler_for(key); struct type_handler_t* handler = _find_handler_for(key);
@ -181,7 +177,7 @@ int _validate_config(FILE* file) {
} }
} while(c != ';'); } while(c != ';');
return colon_count <= 1; return colon_count == 1;
} }
static static