struct trie_node *child;
for (p = 0; (c = trie->strings->buf[node->prefix_off + p]); p++) {
- char _cleanup_free_ *s = NULL;
+ _cleanup_free_ char *s = NULL;
ssize_t off;
- struct trie_node _cleanup_free_ *new_child = NULL;
+ _cleanup_free_ struct trie_node *new_child = NULL;
if (c == search[i + p])
continue;
FILE *f;
char line[LINE_MAX];
char match[LINE_MAX];
- char cond[LINE_MAX];
f = fopen(filename, "re");
if (f == NULL)
return -errno;
match[0] = '\0';
- cond[0] = '\0';
while (fgets(line, sizeof(line), f)) {
size_t len;
/* new line, new record */
if (line[0] == '\n') {
match[0] = '\0';
- cond[0] = '\0';
continue;
}
/* start of new record */
if (match[0] == '\0') {
strcpy(match, line);
- cond[0] = '\0';
continue;
}
- if (line[0] == '+') {
- strcpy(cond, line);
- continue;
- }
-
- /* TODO: support +; skip the entire record until we support it */
- if (cond[0] != '\0')
- continue;
-
- /* value lines */
+ /* value line */
if (line[0] == ' ') {
char *value;
value[0] = '\0';
value++;
trie_insert(trie, trie->root, match, line, value);
+ continue;
}
+
+ log_error("Error parsing line '%s' in '%s\n", line, filename);
}
fclose(f);
return 0;