41 typedef void (*oscap_dump_func) ();
43 typedef bool (*oscap_cmp_func) (
void *,
void *);
64 void oscap_create_lists(
struct oscap_list **first, ...);
65 bool oscap_list_add(
struct oscap_list *list,
void *value);
66 bool oscap_list_push(
struct oscap_list *list,
void *value);
67 bool oscap_list_pop(
struct oscap_list *list, oscap_destruct_func destructor);
68 bool oscap_list_remove(
struct oscap_list *list,
void *value, oscap_cmp_func compare, oscap_destruct_func destructor);
70 void oscap_list_free(
struct oscap_list *list, oscap_destruct_func destructor);
71 void oscap_list_free0(
struct oscap_list *list);
72 void oscap_list_dump(
struct oscap_list *list, oscap_dump_func dumper,
int depth);
73 int oscap_list_get_itemcount(
struct oscap_list *list);
74 bool oscap_list_contains(
struct oscap_list *list,
void *what, oscap_cmp_func compare);
82 typedef bool(*oscap_filter_func) (
void *,
void *);
87 oscap_filter_func filter;
94 void *oscap_iterator_new(
struct oscap_list *list);
95 void *oscap_iterator_new_filter(
struct oscap_list *list, oscap_filter_func filter,
void *user_data);
97 size_t oscap_iterator_get_itemcount(
const struct oscap_iterator *it);
105 void *oscap_list_find(
struct oscap_list *list,
void *what, oscap_cmp_func compare);
113 #define OSCAP_FOREACH_GENERIC(itype, vtype, val, init_val, code) \
115 struct itype##_iterator *val##_iter = (init_val); \
117 while (itype##_iterator_has_more(val##_iter)) { \
118 val = itype##_iterator_next(val##_iter); \
121 itype##_iterator_free(val##_iter); \
132 #define OSCAP_FOREACH(type, val, init_val, code) \
133 OSCAP_FOREACH_GENERIC(type, struct type *, val, init_val, code)
146 #define OSCAP_FOR_GENERIC(itype, vtype, val, init_val) \
147 vtype val = NULL; struct itype##_iterator *val##_iter = (init_val); \
148 while (itype##_iterator_has_more(val##_iter) \
149 ? (val = itype##_iterator_next(val##_iter), true) \
150 : (itype##_iterator_free(val##_iter), val##_iter = NULL, false))
159 #define OSCAP_FOR(type, val, init_val) OSCAP_FOR_GENERIC(type, struct type *, val, init_val)
167 #define OSCAP_FOR_STR(val, init_val) OSCAP_FOR_GENERIC(oscap_string, const char *, val, init_val)
174 typedef int (*oscap_compare_func) (
const char *,
const char *);
187 oscap_compare_func cmp;
197 struct oscap_htable *oscap_htable_new1(oscap_compare_func cmp,
size_t hsize);
219 bool oscap_htable_add(
struct oscap_htable *htable,
const char *key,
void *item);
225 void *oscap_htable_get(
struct oscap_htable *htable,
const char *key);
227 void *oscap_htable_detach(
struct oscap_htable *htable,
const char *key);
229 void oscap_htable_dump(
struct oscap_htable *htable, oscap_dump_func dumper,
int depth);
236 void oscap_htable_free(
struct oscap_htable *htable, oscap_destruct_func destructor);
291 void oscap_htable_iterator_next_kv(
struct oscap_htable_iterator *hit,
const char **key,
void **value);
305 void oscap_print_depth(
int depth);
General OpenScap functions and types.
Multilingual text processing interface.