list_t add more general search, change previose search name
This commit is contained in:
@@ -30,7 +30,8 @@
|
|||||||
void remove_all_list_in_##type(struct main_list_##type *var_list);\
|
void remove_all_list_in_##type(struct main_list_##type *var_list);\
|
||||||
void increment_list_##type(struct main_list_##type * var_list);\
|
void increment_list_##type(struct main_list_##type * var_list);\
|
||||||
void decrement_list_##type(struct main_list_##type * var_list);\
|
void decrement_list_##type(struct main_list_##type * var_list);\
|
||||||
struct list_##type * search_from_begin_in_list_##type(struct main_list_##type *var_list, type value, int funcCmp(type, type));
|
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), void (*incr_or_decr_mov)(struct main_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));\
|
||||||
|
|
||||||
|
|
||||||
GENERATE_LIST_ALL(TYPE_CHAR)
|
GENERATE_LIST_ALL(TYPE_CHAR)
|
||||||
@@ -203,14 +204,17 @@ GENERATE_LIST_ALL(TYPE_PTR)
|
|||||||
var_list->current_list = (var_list->current_list)->preview;\
|
var_list->current_list = (var_list->current_list)->preview;\
|
||||||
--(var_list->current_index);\
|
--(var_list->current_index);\
|
||||||
}\
|
}\
|
||||||
struct list_##type * search_from_begin_in_list_##type(struct main_list_##type *var_list, type value, int (*funcCmp)(type, type)){\
|
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), void (*incr_or_decr_mov)(struct main_list_##type *)){\
|
||||||
for(move_current_to_begin_list_##type(var_list); var_list->current_list; increment_list_##type(var_list)){\
|
for(; var_list->current_list; incr_or_decr_mov(var_list)){\
|
||||||
if(0 == funcCmp(value, var_list->current_list->value))\
|
if(0 == funcCmp(value, var_list->current_list->value))\
|
||||||
return var_list->current_list;\
|
return var_list->current_list;\
|
||||||
}\
|
}\
|
||||||
return NULL;\
|
return NULL;\
|
||||||
}\
|
}\
|
||||||
|
struct list_##type * search_first_occ_from_begin_in_list_##type(struct main_list_##type *var_list, type value, int (*funcCmp)(type, type)){\
|
||||||
|
move_current_to_begin_list_##type(var_list);\
|
||||||
|
return search_first_occ_with_mov_from_curr_in_list_##type(var_list, value, funcCmp, increment_list_##type);\
|
||||||
|
}\
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -35,12 +35,14 @@ int y_NODE_T_cmp(y_NODE_T nodeA, y_NODE_T nodeB){
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
struct list_y_NODE_T * search_node_in_list_y_NODE_T(struct main_list_y_NODE_T *listNodes, y_NODE_T node){
|
struct list_y_NODE_T * search_node_in_list_y_NODE_T(struct main_list_y_NODE_T *listNodes, y_NODE_T node){
|
||||||
FOR_LIST_FORM_BEGIN(y_NODE_T, listNodes){
|
/* FOR_LIST_FORM_BEGIN(y_NODE_T, listNodes){
|
||||||
if(y_NODE_T_cmp(node, listNodes->current_list->value) == 0){
|
if(y_NODE_T_cmp(node, listNodes->current_list->value) == 0){
|
||||||
return listNodes->current_list;
|
return listNodes->current_list;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
|
*/
|
||||||
|
return search_first_occ_from_begin_in_list_y_NODE_T(listNodes, node, y_NODE_T_cmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
int set_addr_y_NODE_T(y_NODE_T *node, char * addrStr){
|
int set_addr_y_NODE_T(y_NODE_T *node, char * addrStr){
|
||||||
|
|||||||
Reference in New Issue
Block a user