forked from enlightenment/efl
parent
44f0d70286
commit
cdd37bfdfe
|
@ -442,12 +442,17 @@ extern "C" {
|
||||||
|
|
||||||
char order, sorted;
|
char order, sorted;
|
||||||
|
|
||||||
|
/* Callback for comparing node values, default is direct comparison */
|
||||||
Ecore_Compare_Cb compare;
|
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);
|
Ecore_Sheap *ecore_sheap_new(Ecore_Compare_Cb compare, int size);
|
||||||
void ecore_sheap_destroy(Ecore_Sheap *heap);
|
void ecore_sheap_destroy(Ecore_Sheap *heap);
|
||||||
int ecore_sheap_init(Ecore_Sheap *heap, Ecore_Compare_Cb compare, int size);
|
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);
|
int ecore_sheap_insert(Ecore_Sheap *heap, void *data);
|
||||||
void *ecore_sheap_extract(Ecore_Sheap *heap);
|
void *ecore_sheap_extract(Ecore_Sheap *heap);
|
||||||
void *ecore_sheap_extreme(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)
|
void ecore_sheap_destroy(Ecore_Sheap *heap)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
CHECK_PARAM_POINTER("heap", heap);
|
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->data);
|
||||||
|
|
||||||
FREE(heap);
|
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.
|
* Insert new data into the heap.
|
||||||
* @param heap The heap to insert @a data.
|
* @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);
|
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)
|
if (i < heap->size)
|
||||||
heap->data[i] = newval;
|
heap->data[i] = newval;
|
||||||
|
|
|
@ -1454,8 +1454,9 @@ ecore_config_init_global(char *name)
|
||||||
int
|
int
|
||||||
ecore_config_init(char *name)
|
ecore_config_init(char *name)
|
||||||
{
|
{
|
||||||
char *path;
|
char *path;
|
||||||
Ecore_Config_Prop *list;
|
Ecore_Config_Prop *list;
|
||||||
|
Ecore_Config_Bundle *temp;
|
||||||
_ecore_config_system_init_no_load();
|
_ecore_config_system_init_no_load();
|
||||||
|
|
||||||
__ecore_config_app_name = strdup(name);
|
__ecore_config_app_name = strdup(name);
|
||||||
|
@ -1463,11 +1464,12 @@ ecore_config_init(char *name)
|
||||||
if (!__ecore_config_server_local)
|
if (!__ecore_config_server_local)
|
||||||
return ECORE_CONFIG_ERR_FAIL;
|
return ECORE_CONFIG_ERR_FAIL;
|
||||||
|
|
||||||
/* FIXME should free __ecore_config_bundle_local */
|
temp = __ecore_config_bundle_local;
|
||||||
list = __ecore_config_bundle_local->data;
|
list = __ecore_config_bundle_local->data;
|
||||||
__ecore_config_bundle_local =
|
__ecore_config_bundle_local =
|
||||||
ecore_config_bundle_new(__ecore_config_server_local, "config");
|
ecore_config_bundle_new(__ecore_config_server_local, "config");
|
||||||
__ecore_config_bundle_local->data = list;
|
__ecore_config_bundle_local->data = list;
|
||||||
|
free(temp);
|
||||||
|
|
||||||
path = ecore_config_theme_default_path_get();
|
path = ecore_config_theme_default_path_get();
|
||||||
ecore_config_string_default("/e/themes/search_path", path);
|
ecore_config_string_default("/e/themes/search_path", path);
|
||||||
|
|
Loading…
Reference in New Issue