diff options
Diffstat (limited to 'usr.bin/indent/args.c')
-rw-r--r-- | usr.bin/indent/args.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.bin/indent/args.c b/usr.bin/indent/args.c index 74483ae859bc..631cd9295c9a 100644 --- a/usr.bin/indent/args.c +++ b/usr.bin/indent/args.c @@ -298,7 +298,7 @@ found: char *str = strdup(param_start); if (str == NULL) err(1, NULL); - addkey(str, 4); + add_typename(str); } break; @@ -342,6 +342,7 @@ add_typedefs_from_file(const char *str) { FILE *file; char line[BUFSIZ]; + char *copy; if ((file = fopen(str, "r")) == NULL) { fprintf(stderr, "indent: cannot open file %s\n", str); @@ -349,8 +350,11 @@ add_typedefs_from_file(const char *str) } while ((fgets(line, BUFSIZ, file)) != NULL) { /* Remove trailing whitespace */ - *(line + strcspn(line, " \t\n\r")) = '\0'; - addkey(strdup(line), 4); + line[strcspn(line, " \t\n\r")] = '\0'; + if ((copy = strdup(line)) == NULL) { + err(1, NULL); + } + add_typename(copy); } fclose(file); } |