int sfpr_list_clear(sfpr_list_t *list,void(*clear_cb)(void *data,void *param),void *param) { sfpr_list_node_t *p,*q; if(!clear_cb){ clear_cb = list_clear_cb_default; } p = list->head; while(p != NULL) { q=p->next; /**< 指针后移*/ clear_cb(p->data,param); if(list->pool){ sfpr_mem_free(list->pool,p); }else{ free(p); /**< 释放当前节点*/ } p = q; if(p){ p->prep = NULL; } list->count--; /**< 节点计数器减1*/ } list->head = NULL; list->tail = NULL; return SFPR_SUCCESS; }
static void gdict_applet_cmd_clear (GtkAction *action, GdictApplet *applet) { clear_cb (NULL, applet); }