diff options
Diffstat (limited to 'source/blender/blenlib/intern/listbase.c')
-rw-r--r-- | source/blender/blenlib/intern/listbase.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/listbase.c b/source/blender/blenlib/intern/listbase.c index ded4f31ae05..c4644ff6309 100644 --- a/source/blender/blenlib/intern/listbase.c +++ b/source/blender/blenlib/intern/listbase.c @@ -129,6 +129,30 @@ bool BLI_remlink_safe(ListBase *listbase, void *vlink) } } +/** + * Removes the head from \a listbase and returns it. + */ +void *BLI_pophead(ListBase *listbase) +{ + Link *link; + if ((link = listbase->first)) { + BLI_remlink(listbase, link); + } + return link; +} + + +/** + * Removes the tail from \a listbase and returns it. + */ +void *BLI_poptail(ListBase *listbase) +{ + Link *link; + if ((link = listbase->last)) { + BLI_remlink(listbase, link); + } + return link; +} /** * Removes \a vlink from listbase and disposes of it. Assumes it is linked into there! |