list: ad search from end list

This commit is contained in:
2025-10-11 23:12:12 +02:00
parent 6527394785
commit 4c1fc03d0c
+8
View File
@@ -37,6 +37,7 @@
void decrement_list_##type(struct main_list_##type * var_list);\
struct list_##type * search_first_occ_with_mov_from_curr_in_list_##type(struct main_list_##type *var_list, type value, int (*funcCmp)(type, type), struct list_##type * (*incr_or_decr_mov)(struct list_##type *));\
struct list_##type * search_first_occ_from_begin_in_list_##type(struct main_list_##type *var_list, type value, int (*funcCmp)(type, type));\
struct list_##type * search_first_occ_from_end_in_list_##type(struct main_list_##type *var_list, type value, int (*funcCmp)(type, type));\
struct list_##type * pull_end_from_list_##type(struct main_list_##type *var_list);\
struct list_##type * pull_begin_from_list_##type(struct main_list_##type *var_list);\
void append_list_##type(struct main_list_##type *var_list, struct list_##type *list);\
@@ -364,6 +365,13 @@ GENERATE_LIST_ALL(TYPE_PTR)
pthread_mutex_unlock(var_list->mut_list);\
return search_first_occ_with_mov_from_curr_in_list_##type(var_list, value, funcCmp, local_increment_list_##type);\
}\
struct list_##type * search_first_occ_from_end_in_list_##type(struct main_list_##type *var_list, type value, int (*funcCmp)(type, type)){\
pthread_mutex_lock(var_list->mut_list);\
printf("debug: cur_index change to end");\
var_list->current_list = var_list->end_list;\
pthread_mutex_unlock(var_list->mut_list);\
return search_first_occ_with_mov_from_curr_in_list_##type(var_list, value, funcCmp, local_decrement_list_##type);\
}\
struct list_##type * pull_end_from_list_##type(struct main_list_##type *var_list){\
pthread_mutex_lock(var_list->mut_list);\
struct list_##type *ret = var_list->end_list;\