43#ifdef ZERO_VARIABLES_FOR_SEARCHING
59 if (pgenlist == NULL) {
134 }
else if (
pos == -1) {
136 }
else if (pos < -1 || pos >= pgenlist->
nelements) {
140 if (pos < pgenlist->nelements / 2) {
174 if (NULL != copy_data_func) {
175 for (plink = pgenlist->
head_link; plink; plink = plink->
next) {
180 for (plink = pgenlist->
head_link; plink; plink = plink->
next) {
215 return (NULL != pgenlist ? pgenlist->
tail_link : NULL);
263 if (NULL != free_data_func) {
265 plink2 = plink->
next;
266 free_data_func(plink->
dataptr);
268 }
while (NULL != (plink = plink2));
271 plink2 = plink->
next;
273 }
while (NULL != (plink = plink2));
300 if (NULL != comp_data_func) {
302 plink2 = plink->
next;
303 if (NULL != plink2 && comp_data_func(plink->
dataptr,
308 }
while ((plink = plink2) != NULL);
311 plink2 = plink->
next;
312 if (NULL != plink2 && plink->
dataptr == plink2->dataptr) {
316 }
while ((plink = plink2) != NULL);
335 for (plink = pgenlist->
head_link; NULL != plink; plink = plink->
next) {
336 if (plink->
dataptr == punlink) {
358 for (plink = pgenlist->
head_link; NULL != plink;) {
359 if (plink->
dataptr == punlink) {
384 if (NULL != cond_data_func) {
387 for (; NULL != plink; plink = plink->
next) {
388 if (cond_data_func(plink->
dataptr)) {
409 if (NULL != cond_data_func) {
413 while (NULL != plink) {
414 if (cond_data_func(plink->
dataptr)) {
484 }
else if (0 ==
pos) {
555 for (plink = pgenlist->
head_link; plink; plink = plink->
next) {
573 if (NULL != cond_data_func) {
576 for (; NULL != plink; plink = plink->
next) {
577 if (cond_data_func(plink->
dataptr)) {
598 int (*compar) (
const void *,
const void *))
611 for (i = 0; i <
n; i++, myiter = myiter->
next) {
615 qsort(sortbuf,
n,
sizeof(*sortbuf), compar);
618 for (i = 0; i <
n; i++, myiter = myiter->
next) {
639 for (i = 0; i <
n; i++, myiter = myiter->
next) {
650 for (i = 0; i <
n; i++, myiter = myiter->
next) {
651 myiter->
dataptr = sortbuf[shuffle[i]];
668 for (counter = pgenlist->
nelements / 2; 0 < counter; counter--) {
void fc_allocate_mutex(fc_mutex *mutex)
void fc_release_mutex(fc_mutex *mutex)
void fc_destroy_mutex(fc_mutex *mutex)
void fc_init_mutex(fc_mutex *mutex)
bool genlist_remove(struct genlist *pgenlist, const void *punlink)
void genlist_allocate_mutex(struct genlist *pgenlist)
void genlist_insert(struct genlist *pgenlist, void *data, int pos)
struct genlist * genlist_copy_full(const struct genlist *pgenlist, genlist_copy_fn_t copy_data_func, genlist_free_fn_t free_data_func)
void genlist_release_mutex(struct genlist *pgenlist)
struct genlist * genlist_new(void)
void * genlist_get(const struct genlist *pgenlist, int idx)
int genlist_remove_all(struct genlist *pgenlist, const void *punlink)
void genlist_erase(struct genlist *pgenlist, struct genlist_link *plink)
struct genlist_link * genlist_search_if(const struct genlist *pgenlist, genlist_cond_fn_t cond_data_func)
void genlist_clear(struct genlist *pgenlist)
void genlist_prepend(struct genlist *pgenlist, void *data)
bool genlist_remove_if(struct genlist *pgenlist, genlist_cond_fn_t cond_data_func)
void genlist_append(struct genlist *pgenlist, void *data)
void genlist_unique_full(struct genlist *pgenlist, genlist_comp_fn_t comp_data_func)
static struct genlist_link * genlist_link_at_pos(const struct genlist *pgenlist, int pos)
static void genlist_link_new(struct genlist *pgenlist, void *dataptr, struct genlist_link *prev, struct genlist_link *next)
struct genlist * genlist_copy(const struct genlist *pgenlist)
void genlist_destroy(struct genlist *pgenlist)
void genlist_pop_front(struct genlist *pgenlist)
void genlist_insert_before(struct genlist *pgenlist, void *data, struct genlist_link *plink)
void * genlist_back(const struct genlist *pgenlist)
int genlist_remove_all_if(struct genlist *pgenlist, genlist_cond_fn_t cond_data_func)
void genlist_unique(struct genlist *pgenlist)
void genlist_insert_after(struct genlist *pgenlist, void *data, struct genlist_link *plink)
void genlist_sort(struct genlist *pgenlist, int(*compar)(const void *, const void *))
void genlist_reverse(struct genlist *pgenlist)
struct genlist_link * genlist_tail(const struct genlist *pgenlist)
void * genlist_front(const struct genlist *pgenlist)
struct genlist * genlist_new_full(genlist_free_fn_t free_data_func)
struct genlist_link * genlist_link_get(const struct genlist *pgenlist, int idx)
void genlist_pop_back(struct genlist *pgenlist)
struct genlist_link * genlist_search(const struct genlist *pgenlist, const void *data)
int genlist_size(const struct genlist *pgenlist)
void genlist_shuffle(struct genlist *pgenlist)
static void genlist_link_destroy(struct genlist *pgenlist, struct genlist_link *plink)
bool(* genlist_cond_fn_t)(const void *)
bool(* genlist_comp_fn_t)(const void *, const void *)
static struct genlist_link * genlist_head(const struct genlist *pgenlist)
static void * genlist_link_data(const struct genlist_link *plink)
void *(* genlist_copy_fn_t)(const void *)
void(* genlist_free_fn_t)(void *)
#define fc_assert_ret(condition)
#define fc_assert_ret_val(condition, val)
#define fc_calloc(n, esz)
void array_shuffle(int *array, int n)
struct genlist_link * prev
struct genlist_link * next
struct genlist_link * tail_link
struct genlist_link * head_link
genlist_free_fn_t free_data_func