From 7282b0cafacea9d23bfe67f3650f7b89ac7851cb Mon Sep 17 00:00:00 2001 From: teodor Date: Thu, 21 Jan 2010 13:33:17 +0000 Subject: [PATCH] add pop/push cells into list --- glist.c | 10 ++++++++++ glist.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/glist.c b/glist.c index ba9fc9d..4422fd6 100644 --- 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) diff --git a/glist.h b/glist.h index 3221fe0..beb685d 100644 --- a/glist.h +++ b/glist.h @@ -58,8 +58,10 @@ typedef struct GList { GListCell* GListPop(GList *l); GList* GListPush(GList *l, void *ptr); +GList* GListPushCell(GList *l, GListCell* c); GListCell* GListShift(GList *l); GList* GListUnshift(GList *l, void *ptr); +GList* GListUnshiftCell(GList *l, GListCell* c); GList* GListInsert(GList *l, GListCell *prev, void *ptr); GList* GListDelete(GList *l, GListCell *c); GListCell* GListGet(GList *l, int n); -- 2.37.3