add .gitignore
[tedtools.git] / glist.c
diff --git a/glist.c b/glist.c
index 59213ac..4422fd6 100644 (file)
--- a/glist.c
+++ b/glist.c
@@ -103,11 +103,21 @@ GListPush(GList *l, void *ptr) {
        return insertCell(l, GLIST_TAIL(l), makeCell(ptr));
 }
 
+GList*
+GListPushCell(GList *l, GListCell* c) {
+       return insertCell(l, GLIST_TAIL(l), c);
+}
+
 GList*
 GListUnshift(GList *l, void *ptr) {
        return insertCell(l, NULL, makeCell(ptr));
 }
 
+GList*
+GListUnshiftCell(GList *l, GListCell* c) {
+       return insertCell(l, NULL, c);
+}
+
 GList*
 GListDelete(GList *l, GListCell *c) {
        if (GLIST_LENGTH(l) <= 0)
@@ -118,11 +128,15 @@ GListDelete(GList *l, GListCell *c) {
                l->head = c->next;
                if ( l->head ) 
                        l->head->prev = NULL;
+               else
+                       l->tail = NULL;
        } else if ( l->tail == c ) {
                tassert( c->next == NULL );
                l->tail = c->prev;
                if ( l->tail )
                        l->tail->next = NULL;
+               else
+                       l->head = NULL;
        } else {
                c->prev->next = c->next;
                c->next->prev = c->prev;