]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Move conf_line and free_line from conf.c to lib.c
authorNeilBrown <neilb@suse.de>
Tue, 2 Jul 2013 00:17:51 +0000 (10:17 +1000)
committerNeilBrown <neilb@suse.de>
Tue, 2 Jul 2013 00:17:51 +0000 (10:17 +1000)
As they are uses for mdstat as well as mdadm.conf, they don't really
belong in conf.c

This removes a dependency between mdmon and conf.c

Signed-off-by: NeilBrown <neilb@suse.de>
config.c
lib.c

index 16517e1efd127da63f25d2b37329b60c902a2678..5cf6ae5f1043f7dff1b292d3619bcb2e7b7f0a59 100644 (file)
--- a/config.c
+++ b/config.c
@@ -108,45 +108,6 @@ int match_keyword(char *word)
        return -1;
 }
 
-/*
- * conf_line reads one logical line from the conffile.
- * It skips comments and continues until it finds a line that starts
- * with a non blank/comment.  This character is pushed back for the next call
- * A doubly linked list of words is returned.
- * the first word will be a keyword.  Other words will have had quotes removed.
- */
-
-char *conf_line(FILE *file)
-{
-       char *w;
-       char *list;
-
-       w = conf_word(file, 1);
-       if (w == NULL) return NULL;
-
-       list = dl_strdup(w);
-       free(w);
-       dl_init(list);
-
-       while ((w = conf_word(file,0))){
-               char *w2 = dl_strdup(w);
-               free(w);
-               dl_add(list, w2);
-       }
-/*    printf("got a line\n");*/
-       return list;
-}
-
-void free_line(char *line)
-{
-       char *w;
-       for (w=dl_next(line); w != line; w=dl_next(line)) {
-               dl_del(w);
-               dl_free(w);
-       }
-       dl_free(line);
-}
-
 struct conf_dev {
        struct conf_dev *next;
        char *name;
diff --git a/lib.c b/lib.c
index 840c11f61a835faa5a774a41e6432ae27767d238..8285f346c25e2fe4254ab851b43e43c2ae6a7b16 100644 (file)
--- a/lib.c
+++ b/lib.c
@@ -23,6 +23,7 @@
  */
 
 #include       "mdadm.h"
+#include       "dlink.h"
 #include       <ctype.h>
 
 /* This fill contains various 'library' style function.  They
@@ -407,3 +408,42 @@ unsigned long GCD(unsigned long a, unsigned long b)
        }
        return a;
 }
+
+/*
+ * conf_line reads one logical line from the conffile or mdstat.
+ * It skips comments and continues until it finds a line that starts
+ * with a non blank/comment.  This character is pushed back for the next call
+ * A doubly linked list of words is returned.
+ * the first word will be a keyword.  Other words will have had quotes removed.
+ */
+
+char *conf_line(FILE *file)
+{
+       char *w;
+       char *list;
+
+       w = conf_word(file, 1);
+       if (w == NULL) return NULL;
+
+       list = dl_strdup(w);
+       free(w);
+       dl_init(list);
+
+       while ((w = conf_word(file,0))){
+               char *w2 = dl_strdup(w);
+               free(w);
+               dl_add(list, w2);
+       }
+/*    printf("got a line\n");*/
+       return list;
+}
+
+void free_line(char *line)
+{
+       char *w;
+       for (w=dl_next(line); w != line; w=dl_next(line)) {
+               dl_del(w);
+               dl_free(w);
+       }
+       dl_free(line);
+}