Created
July 16, 2009 06:09
-
-
Save ammojamo/148250 to your computer and use it in GitHub Desktop.
Iterator interface for glib GList
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Simple iterator implementation for iterating over GLists and removing */ | |
/* elements during iteration. */ | |
typedef GList *GIterator; | |
static inline GIterator *g_iter(GList **list) { | |
return list; | |
} | |
static inline GList *g_iter_current(GIterator *iterator) { | |
return *iterator; | |
} | |
static inline GIterator *g_iter_next(GIterator *iterator) { | |
return &((*iterator)->next); | |
} | |
static inline GIterator *g_iter_remove(GIterator *iter) { | |
*iter = g_list_delete_link(*iter, *iter); | |
return iter; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment