aboutsummaryrefslogtreecommitdiffstats
path: root/util.c
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2008-09-26 19:45:08 -0700
committerWayne Davison <wayned@samba.org>2008-09-26 19:45:08 -0700
commite0c572c5c691da243a3187f440daab739c0b3412 (patch)
tree5e9d1a5b92f841653650fff80b66b9fd4f9e722b /util.c
parent315c2152d0a6fbd47690feb38b2410114038278f (diff)
downloadandroid_external_rsync-e0c572c5c691da243a3187f440daab739c0b3412.tar.gz
android_external_rsync-e0c572c5c691da243a3187f440daab739c0b3412.tar.bz2
android_external_rsync-e0c572c5c691da243a3187f440daab739c0b3412.zip
Moved the flist_ndx_{push,pop}() routines from io.c into util.c.
Diffstat (limited to 'util.c')
-rw-r--r--util.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/util.c b/util.c
index ea247751..6b075d0a 100644
--- a/util.c
+++ b/util.c
@@ -1540,6 +1540,39 @@ int bitbag_next_bit(struct bitbag *bb, int after)
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)
{