RList
src/include/rlist/common.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2011, Stefan Götz <stefan.goetz@web.de>
00003  *
00004  * Permission to use, copy, modify, and/or distribute this software for any
00005  * purpose with or without fee is hereby granted, provided that the above
00006  * copyright notice and this permission notice appear in all copies.
00007  *
00008  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
00009  * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
00010  * AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
00011  * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
00012  * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
00013  * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
00014  * PERFORMANCE OF THIS SOFTWARE.
00015  */
00016 
00022 #ifndef RLIST_COMMON_H
00023 #define RLIST_COMMON_H
00024 
00025 #include <stdbool.h>
00026 
00037 typedef void (*rl_free_fn)(void *payload);
00038 
00054 typedef bool (*rl_match_fn)(void *const payload,
00055                             void *const context);
00056 
00061 enum rl_iterator_state_ {
00062     /* in-list, iterator can be used with any function */
00063     RL_ISTATE_IN_LIST_,
00064     /* post-delete, do not use iterator with any public function except
00065      * drl_next() or drl_prev() */
00066     RL_ISTATE_POST_DELETE_,
00067     /* end-of-list, do not use iterator with any public function except
00068      * drl_insert_before() */
00069     RL_ISTATE_END_OF_LIST_,
00070 };
00071 
00072 #endif /* RLIST_COMMON_H */