forked from enlightenment/efl
parent
44f0d70286
commit
cdd37bfdfe
|
@ -442,12 +442,17 @@ extern "C" {
|
|||
|
||||
char order, sorted;
|
||||
|
||||
/* Callback for comparing node values, default is direct comparison */
|
||||
Ecore_Compare_Cb compare;
|
||||
|
||||
/* Callback for freeing node data, default is NULL */
|
||||
Ecore_Free_Cb free_func;
|
||||
};
|
||||
|
||||
Ecore_Sheap *ecore_sheap_new(Ecore_Compare_Cb compare, int size);
|
||||
void ecore_sheap_destroy(Ecore_Sheap *heap);
|
||||
int ecore_sheap_init(Ecore_Sheap *heap, Ecore_Compare_Cb compare, int size);
|
||||
int ecore_sheap_set_free_cb(Ecore_Sheap *heap, Ecore_Free_Cb free_func);
|
||||
int ecore_sheap_insert(Ecore_Sheap *heap, void *data);
|
||||
void *ecore_sheap_extract(Ecore_Sheap *heap);
|
||||
void *ecore_sheap_extreme(Ecore_Sheap *heap);
|
||||
|
|
|
@ -63,16 +63,38 @@ int ecore_sheap_init(Ecore_Sheap *heap, Ecore_Compare_Cb compare, int size)
|
|||
*/
|
||||
void ecore_sheap_destroy(Ecore_Sheap *heap)
|
||||
{
|
||||
int i;
|
||||
|
||||
CHECK_PARAM_POINTER("heap", heap);
|
||||
|
||||
/*
|
||||
* FIXME: Need to setup destructor callbacks for this class.
|
||||
* Free data in heap
|
||||
*/
|
||||
if (heap->free_func)
|
||||
for (i = 0; i < heap->size; i++)
|
||||
heap->free_func(heap->data[i]);
|
||||
|
||||
FREE(heap->data);
|
||||
|
||||
FREE(heap);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the function for freeing data.
|
||||
* @param heap The heap that will use this function when nodes are
|
||||
* destroyed.
|
||||
* @param free_func The function that will free the key data.
|
||||
* @return @c TRUE on successful set, @c FALSE otherwise.
|
||||
*/
|
||||
int ecore_sheap_set_free_cb(Ecore_Sheap *heap, Ecore_Free_Cb free_func)
|
||||
{
|
||||
CHECK_PARAM_POINTER_RETURN("heap", heap, FALSE);
|
||||
|
||||
heap->free_func = free_func;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert new data into the heap.
|
||||
* @param heap The heap to insert @a data.
|
||||
|
@ -215,7 +237,7 @@ int ecore_sheap_change(Ecore_Sheap *heap, void *item, void *newval)
|
|||
|
||||
CHECK_PARAM_POINTER_RETURN("heap", heap, FALSE);
|
||||
|
||||
for (i = 0; i < heap->size && heap->compare(heap->data[i], item); heap++);
|
||||
for (i = 0; i < heap->size && heap->compare(heap->data[i], item); i++);
|
||||
|
||||
if (i < heap->size)
|
||||
heap->data[i] = newval;
|
||||
|
|
|
@ -1456,6 +1456,7 @@ ecore_config_init(char *name)
|
|||
{
|
||||
char *path;
|
||||
Ecore_Config_Prop *list;
|
||||
Ecore_Config_Bundle *temp;
|
||||
_ecore_config_system_init_no_load();
|
||||
|
||||
__ecore_config_app_name = strdup(name);
|
||||
|
@ -1463,11 +1464,12 @@ ecore_config_init(char *name)
|
|||
if (!__ecore_config_server_local)
|
||||
return ECORE_CONFIG_ERR_FAIL;
|
||||
|
||||
/* FIXME should free __ecore_config_bundle_local */
|
||||
temp = __ecore_config_bundle_local;
|
||||
list = __ecore_config_bundle_local->data;
|
||||
__ecore_config_bundle_local =
|
||||
ecore_config_bundle_new(__ecore_config_server_local, "config");
|
||||
__ecore_config_bundle_local->data = list;
|
||||
free(temp);
|
||||
|
||||
path = ecore_config_theme_default_path_get();
|
||||
ecore_config_string_default("/e/themes/search_path", path);
|
||||
|
|
Loading…
Reference in New Issue