76 if(strcmp(f->
flag, flag) == 0) {
92 str = (
char*) calloc(flaglen + 1, 1);
94 strncpy(str, flag, flaglen);
217 if((str != NULL) && (*str != 0)) {
218 const char* strptr = str;
222 if(!((*str ==
'\0') || (isspace(*str) != 0) || (*str ==
':'))) {
227 count = strtol(str + 1, &newstr, 0);
228 if((*newstr !=
'\0') && (isspace(*newstr) == 0)) {
250 if((flag != NULL) && (new_flag != NULL)) {
276 n += strlen(f->
flag) + started;
278 n += sprintf(countbuf,
":%d", f->
count);
282 buf = (
char*) calloc(n + 1, 1);
290 bufptr += sprintf(bufptr,
"%s%s:%d", started ? sep :
"", f->
flag, f->
count);
292 bufptr += sprintf(bufptr,
"%s%s", started ? sep :
"", f->
flag);
354 if((flag != NULL) && (*flag != 0)) {
356 retval = f != NULL ? f->
count : 0;
387 if(operand == NULL) {
#define when_failed(x, l)
#define when_str_empty(x, l)
static amxc_flag_t * amxc_set_flag_find(const amxc_set_t *const set, const char *flag)
static void amxc_set_flag_delete(amxc_set_t *set, amxc_llist_it_t *it)
static void amxc_set_flag_free(amxc_llist_it_t *it)
static void amxc_set_flag_add(amxc_set_t *set, const char *flag, int flaglen, int count)
Ambiorix set API header file.
void(* amxc_set_alert_t)(amxc_set_t *set, const char *flag, bool value, void *priv)
Flag set alert handler type.
#define amxc_container_of(addr, type, member)
Calculates the address of the containing structure.
void amxc_llist_it_take(amxc_llist_it_t *const it)
Removes the iterator from the list.
int amxc_llist_append(amxc_llist_t *const llist, amxc_llist_it_t *const it)
Adds an item to the end of the linked list.
#define amxc_llist_iterate(it, list)
Loops over the list from head to tail.
int amxc_llist_init(amxc_llist_t *const llist)
Initializes a linked list.
void amxc_llist_clean(amxc_llist_t *const llist, amxc_llist_it_delete_t func)
Removes all items from the linked list.
#define amxc_llist_for_each(it, list)
Loops over the list from head to tail.
void amxc_set_remove_flag(amxc_set_t *set, const char *flag)
Removes a flag from a set or decreases the flag counter.
char * amxc_set_to_string_sep(const amxc_set_t *const set, const char *sep)
Converts a set to a separated string of flags.
int amxc_set_new(amxc_set_t **set, bool counted)
Allocates a set.
void amxc_set_reset(amxc_set_t *set)
Reset or empty a set, i.e. clear all flags.
amxc_set_t * amxc_set_copy(const amxc_set_t *const set)
Copies a set.
void amxc_set_intersect(amxc_set_t *const set, const amxc_set_t *const operand)
Intersect a set with another set.
bool amxc_set_is_equal(const amxc_set_t *const set1, const amxc_set_t *const set2)
Compare two sets.
void amxc_set_add_flag(amxc_set_t *set, const char *flag)
Adds a flag to a set, or increases the flag counter.
void amxc_set_delete(amxc_set_t **set)
Frees a set.
void amxc_set_symmetric_difference(amxc_set_t *const set, const amxc_set_t *const operand)
Calculates the symmetric difference of two sets.
int amxc_set_init(amxc_set_t *const set, bool counted)
Initializes a set.
char * amxc_set_to_string(const amxc_set_t *const set)
Converts a set to a space-separated string of flags.
uint32_t amxc_set_get_count(const amxc_set_t *const set, const char *flag)
Get a flag counter.
int amxc_set_parse(amxc_set_t *set, const char *str)
Parses a space-separated string of flags and adds them to the set.
void amxc_set_clean(amxc_set_t *const set)
Cleans a set.
void amxc_set_union(amxc_set_t *const set, const amxc_set_t *const operand)
Joins two sets.
bool amxc_set_has_flag(const amxc_set_t *const set, const char *flag)
Check if a set contains a flag.
void amxc_set_alert_cb(amxc_set_t *set, amxc_set_alert_t handler, void *priv)
Install a set alert callback function.
void amxc_set_subtract(amxc_set_t *const set, const amxc_set_t *const operand)
Subtract a set from another set.
The linked list iterator structure.
amxc_set_alert_t alert_handler
static amxc_htable_it_t it[2000]