return NULL;
}
+bool list_contains_string(GSList *list, const char *string, const size_t max_len)
+{
+ if (list == NULL || string == NULL)
+ return false;
+
+ for (GSList *iterator = list; iterator; iterator = iterator->next) {
+ if (strncmp((char*)iterator->data, string, max_len) == 0)
+ return true;
+ }
+
+ return false;
+}
+
GSList *get_filepaths(char *map_path)
{
char *line = NULL;
snprintf(file_name, n+1, "%s", exe_filename);
- file_list = g_slist_append(file_list, file_name);
+ if (!list_contains_string(file_list, file_name, PATH_MAX))
+ file_list = g_slist_append(file_list, file_name);
+ else
+ free(file_name);
}
}