Moved the flist_ndx_{push,pop}() routines from io.c into util.c.
authorWayne Davison <wayned@samba.org>
Sat, 27 Sep 2008 02:45:08 +0000 (19:45 -0700)
committerWayne Davison <wayned@samba.org>
Sat, 27 Sep 2008 02:45:08 +0000 (19:45 -0700)
io.c
rsync.h
util.c

diff --git a/io.c b/io.c
index ed556b1..70756b8 100644 (file)
--- a/io.c
+++ b/io.c
@@ -124,16 +124,7 @@ static void writefd(int fd, const char *buf, size_t len);
 static void writefd_unbuffered(int fd, const char *buf, size_t len);
 static void mplex_write(int fd, enum msgcode code, const char *buf, size_t len, int convert);
 
 static void writefd_unbuffered(int fd, const char *buf, size_t len);
 static void mplex_write(int fd, enum msgcode code, const char *buf, size_t len, int convert);
 
-struct flist_ndx_item {
-       struct flist_ndx_item *next;
-       int ndx;
-};
-
-struct flist_ndx_list {
-       struct flist_ndx_item *head, *tail;
-};
-
-static struct flist_ndx_list redo_list, hlink_list;
+static flist_ndx_list redo_list, hlink_list;
 
 struct msg_list_item {
        struct msg_list_item *next;
 
 struct msg_list_item {
        struct msg_list_item *next;
@@ -147,39 +138,6 @@ struct msg_list {
 
 static struct msg_list msg_queue;
 
 
 static struct msg_list msg_queue;
 
-static void flist_ndx_push(struct flist_ndx_list *lp, int ndx)
-{
-       struct flist_ndx_item *item;
-
-       if (!(item = new(struct flist_ndx_item)))
-               out_of_memory("flist_ndx_push");
-       item->next = NULL;
-       item->ndx = ndx;
-       if (lp->tail)
-               lp->tail->next = item;
-       else
-               lp->head = item;
-       lp->tail = item;
-}
-
-static int flist_ndx_pop(struct flist_ndx_list *lp)
-{
-       struct flist_ndx_item *next;
-       int ndx;
-
-       if (!lp->head)
-               return -1;
-
-       ndx = lp->head->ndx;
-       next = lp->head->next;
-       free(lp->head);
-       lp->head = next;
-       if (!next)
-               lp->tail = NULL;
-
-       return ndx;
-}
-
 static void got_flist_entry_status(enum festatus status, const char *buf)
 {
        int ndx = IVAL(buf, 0);
 static void got_flist_entry_status(enum festatus status, const char *buf)
 {
        int ndx = IVAL(buf, 0);
diff --git a/rsync.h b/rsync.h
index 7eb9a80..c288a1f 100644 (file)
--- a/rsync.h
+++ b/rsync.h
@@ -834,6 +834,15 @@ struct stats {
 
 struct chmod_mode_struct;
 
 
 struct chmod_mode_struct;
 
+struct flist_ndx_item {
+       struct flist_ndx_item *next;
+       int ndx;
+};
+
+typedef struct {
+       struct flist_ndx_item *head, *tail;
+} flist_ndx_list;
+
 #define EMPTY_ITEM_LIST {NULL, 0, 0}
 
 typedef struct {
 #define EMPTY_ITEM_LIST {NULL, 0, 0}
 
 typedef struct {
diff --git a/util.c b/util.c
index ea24775..6b075d0 100644 (file)
--- a/util.c
+++ b/util.c
@@ -1540,6 +1540,39 @@ int bitbag_next_bit(struct bitbag *bb, int after)
        return -1;
 }
 
        return -1;
 }
 
+void flist_ndx_push(flist_ndx_list *lp, int ndx)
+{
+       struct flist_ndx_item *item;
+
+       if (!(item = new(struct flist_ndx_item)))
+               out_of_memory("flist_ndx_push");
+       item->next = NULL;
+       item->ndx = ndx;
+       if (lp->tail)
+               lp->tail->next = item;
+       else
+               lp->head = item;
+       lp->tail = item;
+}
+
+int flist_ndx_pop(flist_ndx_list *lp)
+{
+       struct flist_ndx_item *next;
+       int ndx;
+
+       if (!lp->head)
+               return -1;
+
+       ndx = lp->head->ndx;
+       next = lp->head->next;
+       free(lp->head);
+       lp->head = next;
+       if (!next)
+               lp->tail = NULL;
+
+       return ndx;
+}
+
 void *expand_item_list(item_list *lp, size_t item_size,
                       const char *desc, int incr)
 {
 void *expand_item_list(item_list *lp, size_t item_size,
                       const char *desc, int incr)
 {