file already present in list? If not add it */
| 11 | |
| 12 | /* file already present in list? If not add it */ |
| 13 | struct file *file_lookup(const char *name) |
| 14 | { |
| 15 | struct file *file; |
| 16 | |
| 17 | for (file = file_list; file; file = file->next) { |
| 18 | if (!strcmp(name, file->name)) { |
| 19 | return file; |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | file = xmalloc(sizeof(*file)); |
| 24 | memset(file, 0, sizeof(*file)); |
| 25 | file->name = xstrdup(name); |
| 26 | file->next = file_list; |
| 27 | file_list = file; |
| 28 | return file; |
| 29 | } |
| 30 | |
| 31 | /* Allocate initial growable string */ |
| 32 | struct gstr str_new(void) |
no test coverage detected