- fn = malloc(sizeof(struct file_name));
- fn->filename = strdup(fname);
- flist_add_tail(&fn->list, &filename_list);
+ if (flist_empty(&filename_list))
+ return 0;
+
+ flist_for_each(entry, &filename_list) {
+ filename = flist_entry(entry, struct file_name, list)->filename;
+
+ if (strcmp(filename, fname) == 0)
+ return 1;
+ }
+
+ return 0;