diff options
author | Zeev Suraski <zeev@php.net> | 1999-05-12 18:06:14 +0000 |
---|---|---|
committer | Zeev Suraski <zeev@php.net> | 1999-05-12 18:06:14 +0000 |
commit | 853d6c6206f8789bf76be93a2278dcf54bbb64d2 (patch) | |
tree | c570e1e2a0057b25d045c96b2d32fb12ff07ec40 /Zend/zend_llist.c | |
parent | 89a56a139bc7d2247f4e0d6b31eb1a4b8ee383e7 (diff) | |
download | php-git-853d6c6206f8789bf76be93a2278dcf54bbb64d2.tar.gz |
Added prepend to llist
Diffstat (limited to 'Zend/zend_llist.c')
-rw-r--r-- | Zend/zend_llist.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Zend/zend_llist.c b/Zend/zend_llist.c index aabbe6ab21..2f5a011d4d 100644 --- a/Zend/zend_llist.c +++ b/Zend/zend_llist.c @@ -43,6 +43,22 @@ ZEND_API void zend_llist_add_element(zend_llist *l, void *element) } +ZEND_API void zend_llist_prepend_element(zend_llist *l, void *element) +{ + zend_llist_element *tmp = pemalloc(sizeof(zend_llist_element)+l->size-1, l->persistent); + + tmp->next = l->head; + tmp->prev = NULL; + if (l->head) { + l->head->prev = tmp; + } else { + l->tail = tmp; + } + l->head = tmp; + memcpy(tmp->data, element, l->size); +} + + ZEND_API void zend_llist_del_element(zend_llist *l, void *element) { zend_llist_element *current=l->head; |