generalized suffix_list to string_list

Sun, 16 Oct 2011 12:20:52 +0200

author
Mike Becker <universe@uap-core.de>
date
Sun, 16 Oct 2011 12:20:52 +0200
changeset 19
8bac9fd0629d
parent 18
cae1294702aa
child 20
43725438ac50

generalized suffix_list to string_list

cline.c file | annotate | diff | comparison | revisions
settings.c file | annotate | diff | comparison | revisions
settings.h file | annotate | diff | comparison | revisions
string_list.c file | annotate | diff | comparison | revisions
string_list.h file | annotate | diff | comparison | revisions
suffix_list.c file | annotate | diff | comparison | revisions
suffix_list.h file | annotate | diff | comparison | revisions
--- a/cline.c	Sat Oct 15 14:52:12 2011 +0200
+++ b/cline.c	Sun Oct 16 12:20:52 2011 +0200
@@ -126,7 +126,7 @@
   // Find tokens
   char* finder = strtok(suffix, ",");
   while (finder != NULL) {
-    add_suffix(settings->suffixList, finder);
+    add_string(settings->suffixList, finder);
     finder = strtok(NULL, ",");
   }
 
--- a/settings.c	Sat Oct 15 14:52:12 2011 +0200
+++ b/settings.c	Sun Oct 16 12:20:52 2011 +0200
@@ -18,7 +18,7 @@
     settings->recursive          = false;
     settings->includeSuffixes    = false;
     settings->matchesOnly        = false;
-    settings->suffixList         = new_suffix_list_t();
+    settings->suffixList         = new_string_list_t();
     settings->verbose            = true;
   }
 
@@ -26,6 +26,6 @@
 }
 
 void destroy_settings_t(settings_t* settings) {
-  destroy_suffix_list_t(settings->suffixList);
+  destroy_string_list_t(settings->suffixList);
   free(settings);
 }
--- a/settings.h	Sat Oct 15 14:52:12 2011 +0200
+++ b/settings.h	Sun Oct 16 12:20:52 2011 +0200
@@ -9,11 +9,11 @@
 #define SETTINGS_H_
 
 #include "stdinc.h"
-#include "suffix_list.h"
+#include "string_list.h"
 
 typedef struct _settings {
   char fileSeparator;
-  suffix_list_t* suffixList;
+  string_list_t* suffixList;
   bool recursive;
   bool includeSuffixes;
   bool matchesOnly;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/string_list.c	Sun Oct 16 12:20:52 2011 +0200
@@ -0,0 +1,34 @@
+/*
+ * string_list.c
+ *
+ *  Created on: 15.09.2011
+ *      Author: beckermi
+ */
+
+#include "string_list.h"
+
+string_list_t* new_string_list_t() {
+  string_list_t* stringList = malloc(sizeof(string_list_t));
+  stringList->count = 0;
+  stringList->items = NULL;
+
+  return stringList;
+}
+
+void destroy_string_list_t(string_list_t* list) {
+  if (list->items != NULL) {
+    free(list->items);
+  }
+  free(list);
+}
+
+void add_string(string_list_t* list, char* item) {
+  char** reallocated_list =
+    realloc(list->items, sizeof(char*) * (list->count + 1));
+  if (reallocated_list != NULL) {
+    list->items = reallocated_list;
+    list->items[list->count] = item;
+    list->count++;
+  }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/string_list.h	Sun Oct 16 12:20:52 2011 +0200
@@ -0,0 +1,30 @@
+/*
+ * string_list.h
+ *
+ *  Created on: 15.09.2011
+ *      Author: beckermi
+ */
+
+#ifndef STRING_LIST_H_
+#define STRING_LIST_H_
+
+#include "stdinc.h"
+
+typedef struct _string_list {
+  int count;
+  char** items;
+} string_list_t;
+
+#ifdef _cplusplus
+extern "C" {
+#endif
+
+string_list_t* new_string_list_t();
+void destroy_string_list_t(string_list_t*);
+void add_string(string_list_t*, char*);
+
+#ifdef _cplusplus
+}
+#endif
+
+#endif /* STRING_LIST_H_ */
--- a/suffix_list.c	Sat Oct 15 14:52:12 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
- * suffix_list.c
- *
- *  Created on: 15.09.2011
- *      Author: beckermi
- */
-
-#include "suffix_list.h"
-
-suffix_list_t* new_suffix_list_t() {
-  suffix_list_t* suffixList = malloc(sizeof(suffix_list_t));
-  suffixList->count = 0;
-  suffixList->items = NULL;
-
-  return suffixList;
-}
-
-void destroy_suffix_list_t(suffix_list_t* list) {
-  if (list->items != NULL) {
-    free(list->items);
-  }
-  free(list);
-}
-
-void add_suffix(suffix_list_t* list, char* item) {
-  char** reallocated_list =
-    realloc(list->items, sizeof(char*) * (list->count + 1));
-  if (reallocated_list != NULL) {
-    list->items = reallocated_list;
-    list->items[list->count] = item;
-    list->count++;
-  }
-}
-
--- a/suffix_list.h	Sat Oct 15 14:52:12 2011 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-/*
- * suffix_list.h
- *
- *  Created on: 15.09.2011
- *      Author: beckermi
- */
-
-#ifndef SUFFIX_LIST_H_
-#define SUFFIX_LIST_H_
-
-#include "stdinc.h"
-
-typedef struct _suffix_list {
-  int count;
-  char** items;
-} suffix_list_t;
-
-#ifdef _cplusplus
-extern "C" {
-#endif
-
-suffix_list_t* new_suffix_list_t();
-void destroy_suffix_list_t(suffix_list_t*);
-void add_suffix(suffix_list_t*, char*);
-
-#ifdef _cplusplus
-}
-#endif
-
-#endif /* SUFFIX_LIST_H_ */

mercurial