From 2572e14d3ee23cd7fb1a27a40b50a72f14102564 Mon Sep 17 00:00:00 2001 From: Christopher Michael Date: Fri, 23 Jun 2006 06:40:26 +0000 Subject: [PATCH] Formatting to 'E' format. Note: No functional changes, only formatting. SVN revision: 23551 --- .../ecore/src/lib/ecore/ecore_idle_exiter.c | 2 +- legacy/ecore/src/lib/ecore/ecore_list.c | 1209 +++++++++-------- 2 files changed, 641 insertions(+), 570 deletions(-) diff --git a/legacy/ecore/src/lib/ecore/ecore_idle_exiter.c b/legacy/ecore/src/lib/ecore/ecore_idle_exiter.c index deb56ea779..b9d4128a2f 100644 --- a/legacy/ecore/src/lib/ecore/ecore_idle_exiter.c +++ b/legacy/ecore/src/lib/ecore/ecore_idle_exiter.c @@ -2,7 +2,7 @@ #include "Ecore.h" static Ecore_Idle_Exiter *idle_exiters = NULL; -static int idle_exiters_delete_me = 0; +static int idle_exiters_delete_me = 0; /** * Add an idle exiter handler. diff --git a/legacy/ecore/src/lib/ecore/ecore_list.c b/legacy/ecore/src/lib/ecore/ecore_list.c index 0710d5791b..96973d2dac 100644 --- a/legacy/ecore/src/lib/ecore/ecore_list.c +++ b/legacy/ecore/src/lib/ecore/ecore_list.c @@ -37,12 +37,12 @@ _ecore_list2_append(void *in_list, void *in_item) { Ecore_List2 *l, *new_l; Ecore_List2 *list, *item; - + list = in_list; item = in_item; new_l = item; new_l->next = NULL; - if (!list) + if (!list) { new_l->prev = NULL; new_l->last = new_l; @@ -61,15 +61,15 @@ _ecore_list2_prepend(void *in_list, void *in_item) { Ecore_List2 *new_l; Ecore_List2 *list, *item; - + list = in_list; - item = in_item; + item = in_item; new_l = item; new_l->prev = NULL; - if (!list) + if (!list) { new_l->next = NULL; - new_l->last = new_l; + new_l->last = new_l; return new_l; } new_l->next = list; @@ -84,7 +84,7 @@ _ecore_list2_append_relative(void *in_list, void *in_item, void *in_relative) { Ecore_List2 *l; Ecore_List2 *list, *item, *relative; - + list = in_list; item = in_item; relative = in_relative; @@ -93,7 +93,7 @@ _ecore_list2_append_relative(void *in_list, void *in_item, void *in_relative) if (l == relative) { Ecore_List2 *new_l; - + new_l = item; if (l->next) { @@ -117,7 +117,7 @@ _ecore_list2_prepend_relative(void *in_list, void *in_item, void *in_relative) { Ecore_List2 *l; Ecore_List2 *list, *item, *relative; - + list = in_list; item = in_item; relative = in_relative; @@ -126,7 +126,7 @@ _ecore_list2_prepend_relative(void *in_list, void *in_item, void *in_relative) if (l == relative) { Ecore_List2 *new_l; - + new_l = item; new_l->prev = l->prev; new_l->next = l; @@ -192,9 +192,9 @@ _ecore_list2_find(void *in_list, void *in_item) { Ecore_List2 *l; Ecore_List2 *list, *item; - + list = in_list; - item = in_item; + item = in_item; for (l = list; l; l = l->next) { if (l == item) return item; @@ -214,20 +214,22 @@ Functions that create, initialize and destroy Ecore_Lists. * @return A new initialized list on success, @c NULL on failure. * @ingroup Ecore_Data_List_Creation_Group */ -EAPI Ecore_List *ecore_list_new() +EAPI Ecore_List * +ecore_list_new() { - Ecore_List *list; + Ecore_List *list; - list = (Ecore_List *)malloc(sizeof(Ecore_List)); - if (!list) - return NULL; + list = (Ecore_List *)malloc(sizeof(Ecore_List)); + if (!list) + return NULL; - if (!ecore_list_init(list)) { - FREE(list); - return NULL; - } + if (!ecore_list_init(list)) + { + FREE(list); + return NULL; + } - return list; + return list; } /** @@ -236,13 +238,14 @@ EAPI Ecore_List *ecore_list_new() * @return @c TRUE if successful, @c FALSE if an error occurs. * @ingroup Ecore_Data_List_Creation_Group */ -EAPI int ecore_list_init(Ecore_List *list) +EAPI int +ecore_list_init(Ecore_List *list) { - CHECK_PARAM_POINTER_RETURN("list", list, FALSE); + CHECK_PARAM_POINTER_RETURN("list", list, FALSE); - memset(list, 0, sizeof(Ecore_List)); + memset(list, 0, sizeof(Ecore_List)); - return TRUE; + return TRUE; } /** @@ -250,19 +253,21 @@ EAPI int ecore_list_init(Ecore_List *list) * @param list The list to be freed. * @ingroup Ecore_Data_List_Creation_Group */ -EAPI void ecore_list_destroy(Ecore_List * list) +EAPI void +ecore_list_destroy(Ecore_List *list) { - void *data; + void *data; - CHECK_PARAM_POINTER("list", list); + CHECK_PARAM_POINTER("list", list); - while (list->first) { - data = _ecore_list_remove_first(list); - if (list->free_func) - list->free_func(data); - } + while (list->first) + { + data = _ecore_list_remove_first(list); + if (list->free_func) + list->free_func(data); + } - FREE(list); + FREE(list); } /** @@ -272,13 +277,14 @@ EAPI void ecore_list_destroy(Ecore_List * list) * @param free_func The function that will free the key data. * @return @c TRUE on successful set, @c FALSE otherwise. */ -EAPI int ecore_list_set_free_cb(Ecore_List * list, Ecore_Free_Cb free_func) +EAPI int +ecore_list_set_free_cb(Ecore_List *list, Ecore_Free_Cb free_func) { - CHECK_PARAM_POINTER_RETURN("list", list, FALSE); + CHECK_PARAM_POINTER_RETURN("list", list, FALSE); - list->free_func = free_func; + list->free_func = free_func; - return TRUE; + return TRUE; } /** @@ -286,16 +292,17 @@ EAPI int ecore_list_set_free_cb(Ecore_List * list, Ecore_Free_Cb free_func) * @param list The list to check for nodes * @return @c TRUE if no nodes in list, @c FALSE if the list contains nodes */ -EAPI int ecore_list_is_empty(Ecore_List * list) +EAPI int +ecore_list_is_empty(Ecore_List *list) { - int ret = TRUE; + int ret = TRUE; - CHECK_PARAM_POINTER_RETURN("list", list, FALSE); + CHECK_PARAM_POINTER_RETURN("list", list, FALSE); - if (list->nodes) - ret = FALSE; + if (list->nodes) + ret = FALSE; - return ret; + return ret; } /** @@ -303,15 +310,16 @@ EAPI int ecore_list_is_empty(Ecore_List * list) * @param list The list to return the number of the current node. * @return The number of the current node in the list. */ -EAPI int ecore_list_index(Ecore_List * list) +EAPI int +ecore_list_index(Ecore_List *list) { - int ret; + int ret; - CHECK_PARAM_POINTER_RETURN("list", list, FALSE); + CHECK_PARAM_POINTER_RETURN("list", list, FALSE); - ret = list->index; + ret = list->index; - return ret; + return ret; } /** @@ -319,15 +327,16 @@ EAPI int ecore_list_index(Ecore_List * list) * @param list The list to find the number of nodes * @return The number of nodes in the list. */ -EAPI int ecore_list_nodes(Ecore_List * list) +EAPI int +ecore_list_nodes(Ecore_List *list) { - int ret = 0; + int ret = 0; - CHECK_PARAM_POINTER_RETURN("list", list, FALSE); + CHECK_PARAM_POINTER_RETURN("list", list, FALSE); - ret = list->nodes; + ret = list->nodes; - return ret; + return ret; } /** @@ -343,42 +352,44 @@ Functions that are used to add nodes to an Ecore_List. * @return @c FALSE if an error occurs, @c TRUE if appended successfully * @ingroup Ecore_Data_List_Add_Item_Group */ -EAPI inline int ecore_list_append(Ecore_List * list, void *data) +EAPI inline int +ecore_list_append(Ecore_List *list, void *data) { - int ret; - Ecore_List_Node *node; + int ret; + Ecore_List_Node *node; - CHECK_PARAM_POINTER_RETURN("list", list, FALSE); + CHECK_PARAM_POINTER_RETURN("list", list, FALSE); - node = ecore_list_node_new(); - node->data = data; + node = ecore_list_node_new(); + node->data = data; - ret = _ecore_list_append_0(list, node); + ret = _ecore_list_append_0(list, node); - return ret; + return ret; } /* For adding items to the end of the list */ -static int _ecore_list_append_0(Ecore_List * list, Ecore_List_Node *end) +static int +_ecore_list_append_0(Ecore_List *list, Ecore_List_Node *end) { - if (list->last) { - list->last->next = end; - } + if (list->last) + list->last->next = end; - list->last = end; + list->last = end; - if (list->first == NULL) { - list->first = end; - list->index = 0; - list->current = NULL; - } + if (list->first == NULL) + { + list->first = end; + list->index = 0; + list->current = NULL; + } - if (list->index >= list->nodes) - list->index++; + if (list->index >= list->nodes) + list->index++; - list->nodes++; + list->nodes++; - return TRUE; + return TRUE; } /** @@ -388,37 +399,39 @@ static int _ecore_list_append_0(Ecore_List * list, Ecore_List_Node *end) * @return @c FALSE if an error occurs, @c TRUE if prepended successfully. * @ingroup Ecore_Data_List_Add_Item_Group */ -EAPI inline int ecore_list_prepend(Ecore_List * list, void *data) +EAPI inline int +ecore_list_prepend(Ecore_List *list, void *data) { - int ret; - Ecore_List_Node *node; + int ret; + Ecore_List_Node *node; - CHECK_PARAM_POINTER_RETURN("list", list, FALSE); + CHECK_PARAM_POINTER_RETURN("list", list, FALSE); - node = ecore_list_node_new(); - node->data = data; + node = ecore_list_node_new(); + node->data = data; - ret = _ecore_list_prepend_0(list, node); + ret = _ecore_list_prepend_0(list, node); - return ret; + return ret; } /* For adding items to the beginning of the list */ -static int _ecore_list_prepend_0(Ecore_List * list, Ecore_List_Node *start) +static int +_ecore_list_prepend_0(Ecore_List *list, Ecore_List_Node *start) { - /* Put it at the beginning of the list */ - start->next = list->first; + /* Put it at the beginning of the list */ + start->next = list->first; - list->first = start; + list->first = start; - /* If no last node, then the first node is the last node */ - if (list->last == NULL) - list->last = list->first; + /* If no last node, then the first node is the last node */ + if (list->last == NULL) + list->last = list->first; - list->nodes++; - list->index++; + list->nodes++; + list->index++; - return TRUE; + return TRUE; } /** @@ -428,53 +441,56 @@ static int _ecore_list_prepend_0(Ecore_List * list, Ecore_List_Node *start) * @return @c FALSE if there is an error, @c TRUE on success * @ingroup Ecore_Data_List_Add_Item_Group */ -EAPI inline int ecore_list_insert(Ecore_List * list, void *data) +EAPI inline int +ecore_list_insert(Ecore_List *list, void *data) { - int ret; - Ecore_List_Node *node; + int ret; + Ecore_List_Node *node; - CHECK_PARAM_POINTER_RETURN("list", list, FALSE); + CHECK_PARAM_POINTER_RETURN("list", list, FALSE); - node = ecore_list_node_new(); - node->data = data; + node = ecore_list_node_new(); + node->data = data; - ret = _ecore_list_insert(list, node); + ret = _ecore_list_insert(list, node); - return ret; + return ret; } /* For adding items in front of the current position in the list */ -static int _ecore_list_insert(Ecore_List * list, Ecore_List_Node *new_node) +static int +_ecore_list_insert(Ecore_List *list, Ecore_List_Node *new_node) { - /* - * If the current point is at the beginning of the list, then it's the - * same as prepending it to the list. - */ - if (list->current == list->first) - return _ecore_list_prepend_0(list, new_node); + /* + * If the current point is at the beginning of the list, then it's the + * same as prepending it to the list. + */ + if (list->current == list->first) + return _ecore_list_prepend_0(list, new_node); - if (list->current == NULL) { - int ret_value; + if (list->current == NULL) + { + int ret_value; - ret_value = _ecore_list_append_0(list, new_node); - list->current = list->last; + ret_value = _ecore_list_append_0(list, new_node); + list->current = list->last; - return ret_value; - } + return ret_value; + } - /* Setup the fields of the new node */ - new_node->next = list->current; + /* Setup the fields of the new node */ + new_node->next = list->current; - /* And hook the node into the list */ - _ecore_list_goto_index(list, ecore_list_index(list) - 1); + /* And hook the node into the list */ + _ecore_list_goto_index(list, ecore_list_index(list) - 1); - list->current->next = new_node; + list->current->next = new_node; - /* Now move the current item to the inserted item */ - list->current = new_node; - list->nodes++; + /* Now move the current item to the inserted item */ + list->current = new_node; + list->nodes++; - return TRUE; + return TRUE; } /** @@ -489,53 +505,55 @@ Functions that remove nodes from an Ecore_List. * @return A pointer to the removed data on success, @c NULL on failure. * @ingroup Ecore_Data_List_Remove_Item_Group */ -EAPI inline void *ecore_list_remove(Ecore_List * list) +EAPI inline void * +ecore_list_remove(Ecore_List *list) { - void *ret; + void *ret; - CHECK_PARAM_POINTER_RETURN("list", list, NULL); + CHECK_PARAM_POINTER_RETURN("list", list, NULL); - ret = _ecore_list_remove_0(list); + ret = _ecore_list_remove_0(list); - return ret; + return ret; } /* Remove the current item from the list */ -static void *_ecore_list_remove_0(Ecore_List * list) +static void * +_ecore_list_remove_0(Ecore_List *list) { - void *ret = NULL; - Ecore_List_Node *old; + void *ret = NULL; + Ecore_List_Node *old; - if (!list) - return NULL; + if (!list) + return NULL; - if (ecore_list_is_empty(list)) - return NULL; + if (ecore_list_is_empty(list)) + return NULL; - if (!list->current) - return NULL; + if (!list->current) + return NULL; - if (list->current == list->first) - return _ecore_list_remove_first(list); + if (list->current == list->first) + return _ecore_list_remove_first(list); - if (list->current == list->last) - return _ecore_list_remove_last(list); + if (list->current == list->last) + return _ecore_list_remove_last(list); - old = list->current; + old = list->current; - _ecore_list_goto_index(list, list->index - 1); + _ecore_list_goto_index(list, list->index - 1); - list->current->next = old->next; - old->next = NULL; - ret = old->data; - old->data = NULL; + list->current->next = old->next; + old->next = NULL; + ret = old->data; + old->data = NULL; - _ecore_list_next(list); + _ecore_list_next(list); - ecore_list_node_destroy(old, NULL); - list->nodes--; + ecore_list_node_destroy(old, NULL); + list->nodes--; - return ret; + return ret; } /** @@ -544,17 +562,18 @@ static void *_ecore_list_remove_0(Ecore_List * list) * @return @c TRUE on success, @c FALSE on error * @ingroup Ecore_Data_List_Remove_Item_Group */ -EAPI int ecore_list_remove_destroy(Ecore_List *list) +EAPI int +ecore_list_remove_destroy(Ecore_List *list) { - void *data; + void *data; - CHECK_PARAM_POINTER_RETURN("list", list, FALSE); + CHECK_PARAM_POINTER_RETURN("list", list, FALSE); - data = _ecore_list_remove_0(list); - if (list->free_func) - list->free_func(data); + data = _ecore_list_remove_0(list); + if (list->free_func) + list->free_func(data); - return TRUE; + return TRUE; } /** @@ -564,51 +583,53 @@ EAPI int ecore_list_remove_destroy(Ecore_List *list) * failure. * @ingroup Ecore_Data_List_Remove_Item_Group */ -EAPI inline void *ecore_list_remove_first(Ecore_List * list) +EAPI inline void * +ecore_list_remove_first(Ecore_List *list) { - void *ret; + void *ret; - CHECK_PARAM_POINTER_RETURN("list", list, NULL); + CHECK_PARAM_POINTER_RETURN("list", list, NULL); - ret = _ecore_list_remove_first(list); + ret = _ecore_list_remove_first(list); - return ret; + return ret; } /* Remove the first item from the list */ -static void *_ecore_list_remove_first(Ecore_List * list) +static void * +_ecore_list_remove_first(Ecore_List *list) { - void *ret = NULL; - Ecore_List_Node *old; + void *ret = NULL; + Ecore_List_Node *old; - if (!list) - return NULL; + if (!list) + return NULL; - if (ecore_list_is_empty(list)) - return NULL; + if (ecore_list_is_empty(list)) + return NULL; - if (!list->first) - return NULL; + if (!list->first) + return NULL; - old = list->first; + old = list->first; - list->first = list->first->next; + list->first = list->first->next; - if (list->current == old) - list->current = list->first; - else - (list->index ? list->index-- : 0); + if (list->current == old) + list->current = list->first; + else + (list->index ? list->index-- : 0); - if (list->last == old) - list->last = list->first; + if (list->last == old) + list->last = list->first; - ret = old->data; - old->data = NULL; + ret = old->data; + old->data = NULL; - ecore_list_node_destroy(old, NULL); - list->nodes--; + ecore_list_node_destroy(old, NULL); + list->nodes--; - return ret; + return ret; } /** @@ -617,58 +638,60 @@ static void *_ecore_list_remove_first(Ecore_List * list) * @return A pointer to the removed data on success, @c NULL on failure. * @ingroup Ecore_Data_List_Remove_Item_Group */ -EAPI inline void *ecore_list_remove_last(Ecore_List * list) +EAPI inline void * +ecore_list_remove_last(Ecore_List *list) { - void *ret; + void *ret; - CHECK_PARAM_POINTER_RETURN("list", list, NULL); + CHECK_PARAM_POINTER_RETURN("list", list, NULL); - ret = _ecore_list_remove_last(list); + ret = _ecore_list_remove_last(list); - return ret; + return ret; } /* Remove the last item from the list */ -static void *_ecore_list_remove_last(Ecore_List * list) +static void * +_ecore_list_remove_last(Ecore_List *list) { - void *ret = NULL; - Ecore_List_Node *old, *prev; + void *ret = NULL; + Ecore_List_Node *old, *prev; - if (!list) - return NULL; + if (!list) + return NULL; - if (ecore_list_is_empty(list)) - return NULL; + if (ecore_list_is_empty(list)) + return NULL; - if (!list->last) - return NULL; + if (!list->last) + return NULL; - old = list->last; + old = list->last; + if (list->current == old) + list->current = NULL; + + if (list->first == old) + list->first = NULL; + for (prev = list->first; prev && prev->next != old; prev = prev->next); + list->last = prev; + if (prev) + { + prev->next = NULL; if (list->current == old) - list->current = NULL; + list->current = NULL; + } - if (list->first == old) - list->first = NULL; - for (prev = list->first; prev && prev->next != old; prev = prev->next); - list->last = prev; - if (prev) { - prev->next = NULL; - if (list->current == old) { - list->current = NULL; - } - } + if (old) + { + old->next = NULL; + ret = old->data; + old->data = NULL; + } + ecore_list_node_destroy(old, NULL); + list->nodes--; - if (old) { - old->next = NULL; - ret = old->data; - old->data = NULL; - } - - ecore_list_node_destroy(old, NULL); - list->nodes--; - - return ret; + return ret; } /** @@ -684,42 +707,44 @@ Functions that can be used to traverse an Ecore_List. * @return A pointer to new current item on success, @c NULL on failure. * @ingroup Ecore_Data_List_Traverse_Group */ -EAPI inline void *ecore_list_goto_index(Ecore_List * list, int index) +EAPI inline void * +ecore_list_goto_index(Ecore_List *list, int index) { - void *ret; + void *ret; - CHECK_PARAM_POINTER_RETURN("list", list, NULL); + CHECK_PARAM_POINTER_RETURN("list", list, NULL); - ret = _ecore_list_goto_index(list, index); + ret = _ecore_list_goto_index(list, index); - return ret; + return ret; } /* This is the non-threadsafe version, use this inside internal functions that * already lock the list */ -static void *_ecore_list_goto_index(Ecore_List *list, int index) +static void * +_ecore_list_goto_index(Ecore_List *list, int index) { - int i; + int i; - if (!list) - return NULL; + if (!list) + return NULL; - if (ecore_list_is_empty(list)) - return NULL; + if (ecore_list_is_empty(list)) + return NULL; - if (index > ecore_list_nodes(list) || index < 0) - return NULL; + if (index > ecore_list_nodes(list) || index < 0) + return NULL; - _ecore_list_goto_first(list); + _ecore_list_goto_first(list); - for (i = 0; i < index && _ecore_list_next(list); i++); + for (i = 0; i < index && _ecore_list_next(list); i++); - if (i >= list->nodes) - return NULL; + if (i >= list->nodes) + return NULL; - list->index = i; + list->index = i; - return list->current->data; + return list->current->data; } /** @@ -729,49 +754,52 @@ static void *_ecore_list_goto_index(Ecore_List *list, int index) * @return A pointer to @p data on success, @c NULL on failure. * @ingroup Ecore_Data_List_Traverse_Group */ -EAPI inline void *ecore_list_goto(Ecore_List * list, void *data) +EAPI inline void * +ecore_list_goto(Ecore_List *list, void *data) { - void *ret; + void *ret; - CHECK_PARAM_POINTER_RETURN("list", list, NULL); + CHECK_PARAM_POINTER_RETURN("list", list, NULL); - ret = _ecore_list_goto(list, data); + ret = _ecore_list_goto(list, data); - return ret; + return ret; } /* Set the current position to the node containing data */ -static void *_ecore_list_goto(Ecore_List * list, void *data) +static void * +_ecore_list_goto(Ecore_List *list, void *data) { - int index; - Ecore_List_Node *node; + int index; + Ecore_List_Node *node; - if (!list) - return NULL; + if (!list) + return NULL; - index = 0; + index = 0; - node = list->first; - while (node && node->data) { - Ecore_List_Node *next; + node = list->first; + while (node && node->data) + { + Ecore_List_Node *next; - if (node->data == data) - break; + if (node->data == data) + break; - next = node->next; + next = node->next; - node = next; + node = next; - index++; - } + index++; + } - if (!node) - return NULL; + if (!node) + return NULL; - list->current = node; - list->index = index; + list->current = node; + list->index = index; - return list->current->data; + return list->current->data; } /** @@ -780,27 +808,29 @@ static void *_ecore_list_goto(Ecore_List * list, void *data) * @return A pointer to the first item on success, @c NULL on failure * @ingroup Ecore_Data_List_Traverse_Group */ -EAPI inline void *ecore_list_goto_first(Ecore_List *list) +EAPI inline void * +ecore_list_goto_first(Ecore_List *list) { - void *ret; + void *ret; - CHECK_PARAM_POINTER_RETURN("list", list, NULL); + CHECK_PARAM_POINTER_RETURN("list", list, NULL); - ret = _ecore_list_goto_first(list); + ret = _ecore_list_goto_first(list); - return ret; + return ret; } /* Set the current position to the start of the list */ -static void *_ecore_list_goto_first(Ecore_List * list) +static void * +_ecore_list_goto_first(Ecore_List *list) { - if (!list || !list->first) - return NULL; + if (!list || !list->first) + return NULL; - list->current = list->first; - list->index = 0; + list->current = list->first; + list->index = 0; - return list->current->data; + return list->current->data; } /** @@ -809,27 +839,29 @@ static void *_ecore_list_goto_first(Ecore_List * list) * @return A pointer to the last item on success, @c NULL on failure. * @ingroup Ecore_Data_List_Traverse_Group */ -EAPI inline void *ecore_list_goto_last(Ecore_List * list) +EAPI inline void * +ecore_list_goto_last(Ecore_List *list) { - void *ret; + void *ret; - CHECK_PARAM_POINTER_RETURN("list", list, NULL); + CHECK_PARAM_POINTER_RETURN("list", list, NULL); - ret = _ecore_list_goto_last(list); + ret = _ecore_list_goto_last(list); - return ret; + return ret; } /* Set the current position to the end of the list */ -static void *_ecore_list_goto_last(Ecore_List * list) +static void * +_ecore_list_goto_last(Ecore_List *list) { - if (!list || !list->last) - return NULL; + if (!list || !list->last) + return NULL; - list->current = list->last; - list->index = (list->nodes - 1); + list->current = list->last; + list->index = (list->nodes - 1); - return list->current->data; + return list->current->data; } /** @@ -837,26 +869,28 @@ static void *_ecore_list_goto_last(Ecore_List * list) * @param list The list. * @return Returns the data at current position, can be @c NULL. */ -EAPI inline void *ecore_list_current(Ecore_List * list) +EAPI inline void * +ecore_list_current(Ecore_List *list) { - void *ret; + void *ret; - ret = _ecore_list_current(list); + ret = _ecore_list_current(list); - return ret; + return ret; } /* Return the data of the current node without incrementing */ -static void *_ecore_list_current(Ecore_List * list) +static void * +_ecore_list_current(Ecore_List *list) { - void *ret; + void *ret; - if (!list->current) - return NULL; + if (!list->current) + return NULL; - ret = list->current->data; + ret = list->current->data; - return ret; + return ret; } /** @@ -865,36 +899,38 @@ static void *_ecore_list_current(Ecore_List * list) * @param list The list to retrieve data from. * @return The current item in the list on success, @c NULL on failure. */ -EAPI inline void *ecore_list_next(Ecore_List * list) +EAPI inline void * +ecore_list_next(Ecore_List *list) { - void *data; + void *data; - CHECK_PARAM_POINTER_RETURN("list", list, NULL); + CHECK_PARAM_POINTER_RETURN("list", list, NULL); - data = _ecore_list_next(list); + data = _ecore_list_next(list); - return data; + return data; } /* Return the data contained in the current node and go to the next node */ -static void *_ecore_list_next(Ecore_List * list) +static void * +_ecore_list_next(Ecore_List *list) { - void *data; - Ecore_List_Node *ret; - Ecore_List_Node *next; + void *data; + Ecore_List_Node *ret; + Ecore_List_Node *next; - if (!list->current) - return NULL; + if (!list->current) + return NULL; - ret = list->current; - next = list->current->next; + ret = list->current; + next = list->current->next; - list->current = next; - list->index++; + list->current = next; + list->index++; - data = ret->data; + data = ret->data; - return data; + return data; } /** @@ -904,14 +940,15 @@ static void *_ecore_list_next(Ecore_List * list) * @note The data for each item on the list is not freed by * @c ecore_list_clear(). */ -EAPI int ecore_list_clear(Ecore_List * list) +EAPI int +ecore_list_clear(Ecore_List *list) { - CHECK_PARAM_POINTER_RETURN("list", list, FALSE); + CHECK_PARAM_POINTER_RETURN("list", list, FALSE); - while (!ecore_list_is_empty(list)) - _ecore_list_remove_first(list); + while (!ecore_list_is_empty(list)) + _ecore_list_remove_first(list); - return TRUE; + return TRUE; } /** @@ -921,44 +958,44 @@ EAPI int ecore_list_clear(Ecore_List * list) * @return Returns @c TRUE on success, @c FALSE on failure. * @ingroup Ecore_Data_List_Traverse_Group */ -EAPI int ecore_list_for_each(Ecore_List *list, Ecore_For_Each function, - void *user_data) +EAPI int +ecore_list_for_each(Ecore_List *list, Ecore_For_Each function, void *user_data) { - int ret; + int ret; - CHECK_PARAM_POINTER_RETURN("list", list, FALSE); + CHECK_PARAM_POINTER_RETURN("list", list, FALSE); - ret = _ecore_list_for_each(list, function, user_data); + ret = _ecore_list_for_each(list, function, user_data); - return ret; + return ret; } /* The real meat of executing the function for each data node */ -static int _ecore_list_for_each(Ecore_List *list, Ecore_For_Each function, - void *user_data) +static int +_ecore_list_for_each(Ecore_List *list, Ecore_For_Each function, void *user_data) { - void *value; + void *value; - if (!list || !function) - return FALSE; + if (!list || !function) + return FALSE; - _ecore_list_goto_first(list); - while ((value = _ecore_list_next(list)) != NULL) - function(value, user_data); + _ecore_list_goto_first(list); + while ((value = _ecore_list_next(list)) != NULL) + function(value, user_data); - return TRUE; + return TRUE; } /* Initialize a node to starting values */ -EAPI int ecore_list_node_init(Ecore_List_Node * node) +EAPI int +ecore_list_node_init(Ecore_List_Node *node) { + CHECK_PARAM_POINTER_RETURN("node", node, FALSE); - CHECK_PARAM_POINTER_RETURN("node", node, FALSE); + node->next = NULL; + node->data = NULL; - node->next = NULL; - node->data = NULL; - - return TRUE; + return TRUE; } /** @@ -973,18 +1010,20 @@ Ecore_List nodes. * @return A new Ecore_List_Node on success, @c NULL otherwise. * @ingroup Ecore_Data_List_Node_Group */ -EAPI Ecore_List_Node *ecore_list_node_new() +EAPI Ecore_List_Node * +ecore_list_node_new() { - Ecore_List_Node *new_node; + Ecore_List_Node *new_node; - new_node = malloc(sizeof(Ecore_List_Node)); + new_node = malloc(sizeof(Ecore_List_Node)); - if (!ecore_list_node_init(new_node)) { - FREE(new_node); - return NULL; - } + if (!ecore_list_node_init(new_node)) + { + FREE(new_node); + return NULL; + } - return new_node; + return new_node; } /** @@ -994,16 +1033,17 @@ EAPI Ecore_List_Node *ecore_list_node_new() * @return @c TRUE. * @ingroup Ecore_Data_List_Node_Group */ -EAPI int ecore_list_node_destroy(Ecore_List_Node * node, Ecore_Free_Cb free_func) +EAPI int +ecore_list_node_destroy(Ecore_List_Node *node, Ecore_Free_Cb free_func) { - CHECK_PARAM_POINTER_RETURN("node", node, FALSE); + CHECK_PARAM_POINTER_RETURN("node", node, FALSE); - if (free_func && node->data) - free_func(node->data); + if (free_func && node->data) + free_func(node->data); - FREE(node); + FREE(node); - return TRUE; + return TRUE; } /** @@ -1018,20 +1058,22 @@ EAPI int ecore_list_node_destroy(Ecore_List_Node * node, Ecore_Free_Cb free_func * on failure. * @ingroup Ecore_Data_DList_Creation_Group */ -EAPI Ecore_DList *ecore_dlist_new() +EAPI Ecore_DList * +ecore_dlist_new() { - Ecore_DList *list = NULL; + Ecore_DList *list = NULL; - list = (Ecore_DList *)malloc(sizeof(Ecore_DList)); - if (!list) - return NULL; + list = (Ecore_DList *)malloc(sizeof(Ecore_DList)); + if (!list) + return NULL; - if (!ecore_dlist_init(list)) { - IF_FREE(list); - return NULL; - } + if (!ecore_dlist_init(list)) + { + IF_FREE(list); + return NULL; + } - return list; + return list; } /** @@ -1040,13 +1082,14 @@ EAPI Ecore_DList *ecore_dlist_new() * @return @c TRUE if successful, @c FALSE if an error occurs. * @ingroup Ecore_Data_DList_Creation_Group */ -EAPI int ecore_dlist_init(Ecore_DList *list) +EAPI int +ecore_dlist_init(Ecore_DList *list) { - CHECK_PARAM_POINTER_RETURN("list", list, FALSE); + CHECK_PARAM_POINTER_RETURN("list", list, FALSE); - memset(list, 0, sizeof(Ecore_DList)); + memset(list, 0, sizeof(Ecore_DList)); - return TRUE; + return TRUE; } /** @@ -1054,18 +1097,20 @@ EAPI int ecore_dlist_init(Ecore_DList *list) * @param list The doubly linked list to be freed. * @ingroup Ecore_Data_DList_Creation_Group */ -EAPI void ecore_dlist_destroy(Ecore_DList * list) +EAPI void +ecore_dlist_destroy(Ecore_DList *list) { - void *data; - CHECK_PARAM_POINTER("list", list); + void *data; + CHECK_PARAM_POINTER("list", list); - while (list->first) { - data = _ecore_dlist_remove_first(list); - if (list->free_func) - list->free_func(data); - } + while (list->first) + { + data = _ecore_dlist_remove_first(list); + if (list->free_func) + list->free_func(data); + } - FREE(list); + FREE(list); } /** @@ -1076,11 +1121,12 @@ EAPI void ecore_dlist_destroy(Ecore_DList * list) * @return @c TRUE on success, @c FALSE on failure. * @ingroup Ecore_Data_DList_Creation_Group */ -EAPI int ecore_dlist_set_free_cb(Ecore_DList * list, Ecore_Free_Cb free_func) +EAPI int +ecore_dlist_set_free_cb(Ecore_DList *list, Ecore_Free_Cb free_func) { - CHECK_PARAM_POINTER_RETURN("list", list, FALSE); + CHECK_PARAM_POINTER_RETURN("list", list, FALSE); - return ecore_list_set_free_cb(ECORE_LIST(list), free_func); + return ecore_list_set_free_cb(ECORE_LIST(list), free_func); } /** @@ -1088,11 +1134,12 @@ EAPI int ecore_dlist_set_free_cb(Ecore_DList * list, Ecore_Free_Cb free_func) * @param list The given doubly linked list. * @return @c TRUE if there are nodes, @c FALSE otherwise. */ -EAPI int ecore_dlist_is_empty(Ecore_DList * list) +EAPI int +ecore_dlist_is_empty(Ecore_DList *list) { - CHECK_PARAM_POINTER_RETURN("list", list, FALSE); + CHECK_PARAM_POINTER_RETURN("list", list, FALSE); - return ecore_list_is_empty(ECORE_LIST(list)); + return ecore_list_is_empty(ECORE_LIST(list)); } /** @@ -1100,11 +1147,12 @@ EAPI int ecore_dlist_is_empty(Ecore_DList * list) * @param list The given doubly linked list. * @return The index of the current node. */ -EAPI inline int ecore_dlist_index(Ecore_DList * list) +EAPI inline int +ecore_dlist_index(Ecore_DList *list) { - CHECK_PARAM_POINTER_RETURN("list", list, FALSE); + CHECK_PARAM_POINTER_RETURN("list", list, FALSE); - return ecore_list_index(ECORE_LIST(list)); + return ecore_list_index(ECORE_LIST(list)); } /** @@ -1120,24 +1168,24 @@ EAPI inline int ecore_dlist_index(Ecore_DList * list) * @return @c TRUE if the data is successfully appended, @c FALSE otherwise. * @ingroup Ecore_Data_DList_Add_Item_Group */ -EAPI int ecore_dlist_append(Ecore_DList * list, void *data) +EAPI int +ecore_dlist_append(Ecore_DList *list, void *data) { - int ret; - Ecore_DList_Node *prev; - Ecore_DList_Node *node; + int ret; + Ecore_DList_Node *prev; + Ecore_DList_Node *node; - CHECK_PARAM_POINTER_RETURN("list", list, FALSE); + CHECK_PARAM_POINTER_RETURN("list", list, FALSE); - node = ecore_dlist_node_new(); - ECORE_LIST_NODE(node)->data = data; + node = ecore_dlist_node_new(); + ECORE_LIST_NODE(node)->data = data; - prev = ECORE_DLIST_NODE(ECORE_LIST(list)->last); - ret = _ecore_list_append_0(ECORE_LIST(list), ECORE_LIST_NODE(node)); - if (ret) { - node->previous = prev; - } + prev = ECORE_DLIST_NODE(ECORE_LIST(list)->last); + ret = _ecore_list_append_0(ECORE_LIST(list), ECORE_LIST_NODE(node)); + if (ret) + node->previous = prev; - return ret; + return ret; } /** @@ -1147,23 +1195,24 @@ EAPI int ecore_dlist_append(Ecore_DList * list, void *data) * @return @c TRUE if the data is successfully prepended, @c FALSE otherwise. * @ingroup Ecore_Data_DList_Add_Item_Group */ -EAPI int ecore_dlist_prepend(Ecore_DList * list, void *data) +EAPI int +ecore_dlist_prepend(Ecore_DList *list, void *data) { - int ret; - Ecore_DList_Node *prev; - Ecore_DList_Node *node; + int ret; + Ecore_DList_Node *prev; + Ecore_DList_Node *node; - CHECK_PARAM_POINTER_RETURN("list", list, FALSE); + CHECK_PARAM_POINTER_RETURN("list", list, FALSE); - node = ecore_dlist_node_new(); - ECORE_LIST_NODE(node)->data = data; + node = ecore_dlist_node_new(); + ECORE_LIST_NODE(node)->data = data; - prev = ECORE_DLIST_NODE(ECORE_LIST(list)->first); - ret = _ecore_list_prepend_0(ECORE_LIST(list), ECORE_LIST_NODE(node)); - if (ret && prev) - prev->previous = node; + prev = ECORE_DLIST_NODE(ECORE_LIST(list)->first); + ret = _ecore_list_prepend_0(ECORE_LIST(list), ECORE_LIST_NODE(node)); + if (ret && prev) + prev->previous = node; - return ret; + return ret; } /** @@ -1173,44 +1222,45 @@ EAPI int ecore_dlist_prepend(Ecore_DList * list, void *data) * @return @c TRUE on success, @c FALSE otherwise. * @ingroup Ecore_Data_DList_Add_Item_Group */ -EAPI int ecore_dlist_insert(Ecore_DList * list, void *data) +EAPI int +ecore_dlist_insert(Ecore_DList *list, void *data) { - int ret = TRUE; - Ecore_DList_Node *prev; - Ecore_DList_Node *node; + int ret = TRUE; + Ecore_DList_Node *prev; + Ecore_DList_Node *node; - CHECK_PARAM_POINTER_RETURN("list", list, FALSE); + CHECK_PARAM_POINTER_RETURN("list", list, FALSE); - /* - * Identify and shortcut the end cases. - */ - if (!ECORE_LIST(list)->current) - return ecore_dlist_append(list, data); - if (ECORE_LIST(list)->current == ECORE_LIST(list)->first) - return ecore_dlist_prepend(list, data); + /* + * Identify and shortcut the end cases. + */ + if (!ECORE_LIST(list)->current) + return ecore_dlist_append(list, data); + if (ECORE_LIST(list)->current == ECORE_LIST(list)->first) + return ecore_dlist_prepend(list, data); - node = ecore_dlist_node_new(); - ECORE_LIST_NODE(node)->data = data; + node = ecore_dlist_node_new(); + ECORE_LIST_NODE(node)->data = data; - /* Setup the fields of the new node */ - ECORE_LIST_NODE(node)->next = ECORE_LIST(list)->current; + /* Setup the fields of the new node */ + ECORE_LIST_NODE(node)->next = ECORE_LIST(list)->current; - /* And hook the node into the list */ - prev = ECORE_DLIST_NODE(ECORE_LIST(list)->current)->previous; - ECORE_LIST_NODE(prev)->next = ECORE_LIST_NODE(node); - ECORE_DLIST_NODE(ECORE_LIST(list)->current)->previous = node; - node->previous = prev; + /* And hook the node into the list */ + prev = ECORE_DLIST_NODE(ECORE_LIST(list)->current)->previous; + ECORE_LIST_NODE(prev)->next = ECORE_LIST_NODE(node); + ECORE_DLIST_NODE(ECORE_LIST(list)->current)->previous = node; + node->previous = prev; - /* Now move the current item to the inserted item */ - ECORE_LIST(list)->current = ECORE_LIST_NODE(node); - ECORE_LIST(list)->nodes++; + /* Now move the current item to the inserted item */ + ECORE_LIST(list)->current = ECORE_LIST_NODE(node); + ECORE_LIST(list)->nodes++; - return ret; + return ret; } /** * @defgroup Ecore_Data_DList_Remove_Item_Group Doubly Linked List Removing Functions - * + * * Functions that remove nodes from an @c Ecore_DList. */ @@ -1220,22 +1270,24 @@ EAPI int ecore_dlist_insert(Ecore_DList * list, void *data) * @return A pointer to the removed data on success, @c NULL otherwise. * @ingroup Ecore_Data_DList_Remove_Item_Group */ -EAPI void *ecore_dlist_remove(Ecore_DList * list) +EAPI void * +ecore_dlist_remove(Ecore_DList *list) { - void *ret; - Ecore_List *l2 = ECORE_LIST(list); - Ecore_DList_Node *node; + void *ret; + Ecore_List *l2 = ECORE_LIST(list); + Ecore_DList_Node *node; - CHECK_PARAM_POINTER_RETURN("list", list, NULL); + CHECK_PARAM_POINTER_RETURN("list", list, NULL); - if (l2->current) { - node = ECORE_DLIST_NODE(list->current->next); - if (node) - node->previous = ECORE_DLIST_NODE(l2->current)->previous; - } - ret = _ecore_list_remove_0(list); + if (l2->current) + { + node = ECORE_DLIST_NODE(list->current->next); + if (node) + node->previous = ECORE_DLIST_NODE(l2->current)->previous; + } + ret = _ecore_list_remove_0(list); - return ret; + return ret; } /** @@ -1244,15 +1296,16 @@ EAPI void *ecore_dlist_remove(Ecore_DList * list) * @return A pointer to the removed data on success, @c NULL on failure. * @ingroup Ecore_Data_DList_Remove_Item_Group */ -EAPI void *ecore_dlist_remove_first(Ecore_DList * list) +EAPI void * +ecore_dlist_remove_first(Ecore_DList *list) { - void *ret; + void *ret; - CHECK_PARAM_POINTER_RETURN("list", list, NULL); + CHECK_PARAM_POINTER_RETURN("list", list, NULL); - ret = _ecore_dlist_remove_first(list); + ret = _ecore_dlist_remove_first(list); - return ret; + return ret; } /** @@ -1262,34 +1315,36 @@ EAPI void *ecore_dlist_remove_first(Ecore_DList * list) * @return @c TRUE on success, @c FALSE otherwise. * @ingroup Ecore_Data_DList_Remove_Item_Group */ -EAPI int ecore_dlist_remove_destroy(Ecore_DList *list) +EAPI int +ecore_dlist_remove_destroy(Ecore_DList *list) { - void *data; + void *data; - CHECK_PARAM_POINTER_RETURN("list", list, FALSE); + CHECK_PARAM_POINTER_RETURN("list", list, FALSE); - data = ecore_dlist_remove(list); - if (!data) - return FALSE; + data = ecore_dlist_remove(list); + if (!data) + return FALSE; - if (list->free_func) - list->free_func(data); + if (list->free_func) + list->free_func(data); - return TRUE; + return TRUE; } -static void *_ecore_dlist_remove_first(Ecore_DList *list) +static void * +_ecore_dlist_remove_first(Ecore_DList *list) { - void *ret; + void *ret; - if (!list) - return NULL; + if (!list) + return NULL; - ret = _ecore_list_remove_first(list); - if (ret && ECORE_LIST(list)->first) - ECORE_DLIST_NODE(ECORE_LIST(list)->first)->previous = NULL; + ret = _ecore_list_remove_first(list); + if (ret && ECORE_LIST(list)->first) + ECORE_DLIST_NODE(ECORE_LIST(list)->first)->previous = NULL; - return ret; + return ret; } /** @@ -1298,15 +1353,16 @@ static void *_ecore_dlist_remove_first(Ecore_DList *list) * @return A pointer to the removed data on success, @c NULL otherwise. * @ingroup Ecore_Data_DList_Remove_Item_Group */ -EAPI void *ecore_dlist_remove_last(Ecore_DList * list) +EAPI void * +ecore_dlist_remove_last(Ecore_DList *list) { - void *ret; + void *ret; - CHECK_PARAM_POINTER_RETURN("list", list, NULL); + CHECK_PARAM_POINTER_RETURN("list", list, NULL); - ret = _ecore_list_remove_last(list); + ret = _ecore_list_remove_last(list); - return ret; + return ret; } /** @@ -1315,48 +1371,51 @@ EAPI void *ecore_dlist_remove_last(Ecore_DList * list) * @param index The position to move the current item * @return The node at specified index on success, @c NULL on error. */ -EAPI void *ecore_dlist_goto_index(Ecore_DList * list, int index) +EAPI void * +ecore_dlist_goto_index(Ecore_DList *list, int index) { - void *ret; + void *ret; - CHECK_PARAM_POINTER_RETURN("list", list, NULL); + CHECK_PARAM_POINTER_RETURN("list", list, NULL); - ret = _ecore_dlist_goto_index(list, index); + ret = _ecore_dlist_goto_index(list, index); - return ret; + return ret; } /* This is the non-threadsafe version, use this inside internal functions that * already lock the list */ -static void *_ecore_dlist_goto_index(Ecore_DList *list, int index) +static void * +_ecore_dlist_goto_index(Ecore_DList *list, int index) { - int i, increment; + int i, increment; - if (!list) - return NULL; + if (!list) + return NULL; - if (ecore_list_is_empty(ECORE_LIST(list))) - return NULL; + if (ecore_list_is_empty(ECORE_LIST(list))) + return NULL; - if (index > ecore_list_nodes(ECORE_LIST(list)) || index < 0) - return NULL; + if (index > ecore_list_nodes(ECORE_LIST(list)) || index < 0) + return NULL; - if (ECORE_LIST(list)->index >= ECORE_LIST(list)->nodes) - _ecore_list_goto_last(ECORE_LIST(list)); + if (ECORE_LIST(list)->index >= ECORE_LIST(list)->nodes) + _ecore_list_goto_last(ECORE_LIST(list)); - if (index < ECORE_LIST(list)->index) - increment = -1; + if (index < ECORE_LIST(list)->index) + increment = -1; + else + increment = 1; + + for (i = ECORE_LIST(list)->index; i != index; i += increment) + { + if (increment > 0) + _ecore_list_next(list); else - increment = 1; + _ecore_dlist_previous(list); + } - for (i = ECORE_LIST(list)->index; i != index; i += increment) { - if (increment > 0) - _ecore_list_next(list); - else - _ecore_dlist_previous(list); - } - - return _ecore_list_current(list); + return _ecore_list_current(list); } /** @@ -1366,15 +1425,16 @@ static void *_ecore_dlist_goto_index(Ecore_DList *list, int index) * * @return Returns specified data on success, NULL on error */ -EAPI void *ecore_dlist_goto(Ecore_DList * list, void *data) +EAPI void * +ecore_dlist_goto(Ecore_DList *list, void *data) { - void *ret; + void *ret; - CHECK_PARAM_POINTER_RETURN("list", list, NULL); + CHECK_PARAM_POINTER_RETURN("list", list, NULL); - ret = _ecore_list_goto(ECORE_LIST(list), data); + ret = _ecore_list_goto(ECORE_LIST(list), data); - return ret; + return ret; } /** @@ -1383,15 +1443,16 @@ EAPI void *ecore_dlist_goto(Ecore_DList * list, void *data) * * @return Returns a pointer to the first item on success, NULL on failure. */ -EAPI void *ecore_dlist_goto_first(Ecore_DList *list) +EAPI void * +ecore_dlist_goto_first(Ecore_DList *list) { - void *ret; + void *ret; - CHECK_PARAM_POINTER_RETURN("list", list, NULL); + CHECK_PARAM_POINTER_RETURN("list", list, NULL); - ret = _ecore_list_goto_first(list); + ret = _ecore_list_goto_first(list); - return ret; + return ret; } /** @@ -1399,15 +1460,16 @@ EAPI void *ecore_dlist_goto_first(Ecore_DList *list) * @param list: the list to move the current item pointer to the last * @return Returns a pointer to the last item in the list , NULL if empty. */ -EAPI void *ecore_dlist_goto_last(Ecore_DList * list) +EAPI void * +ecore_dlist_goto_last(Ecore_DList *list) { - void *ret; + void *ret; - CHECK_PARAM_POINTER_RETURN("list", list, NULL); + CHECK_PARAM_POINTER_RETURN("list", list, NULL); - ret = _ecore_list_goto_last(ECORE_LIST(list)); + ret = _ecore_list_goto_last(ECORE_LIST(list)); - return ret; + return ret; } /** @@ -1415,13 +1477,14 @@ EAPI void *ecore_dlist_goto_last(Ecore_DList * list) * @param list: the list to the return the current data * @return Returns value of the current data item, NULL if no current item */ -EAPI void *ecore_dlist_current(Ecore_DList * list) +EAPI void * +ecore_dlist_current(Ecore_DList *list) { - void *ret; + void *ret; - ret = _ecore_list_current(ECORE_LIST(list)); + ret = _ecore_list_current(ECORE_LIST(list)); - return ret; + return ret; } /** @@ -1429,13 +1492,14 @@ EAPI void *ecore_dlist_current(Ecore_DList * list) * @param list: the list to move to the next item in. * @return Returns data in the current list node, or NULL on error */ -EAPI void *ecore_dlist_next(Ecore_DList * list) +EAPI void * +ecore_dlist_next(Ecore_DList *list) { - void *data; + void *data; - data = _ecore_list_next(list); + data = _ecore_list_next(list); - return data; + return data; } /** @@ -1443,32 +1507,35 @@ EAPI void *ecore_dlist_next(Ecore_DList * list) * @param list: the list to move to the previous item in. * @return Returns data in the current list node, or NULL on error */ -EAPI void *ecore_dlist_previous(Ecore_DList * list) +EAPI void * +ecore_dlist_previous(Ecore_DList *list) { - void *data; + void *data; - data = _ecore_dlist_previous(list); + data = _ecore_dlist_previous(list); - return data; + return data; } -static void *_ecore_dlist_previous(Ecore_DList * list) +static void * +_ecore_dlist_previous(Ecore_DList *list) { - void *data = NULL; + void *data = NULL; - if (!list) - return NULL; + if (!list) + return NULL; - if (ECORE_LIST(list)->current) { - data = ECORE_LIST(list)->current->data; - ECORE_LIST(list)->current = ECORE_LIST_NODE(ECORE_DLIST_NODE( - ECORE_LIST(list)->current)->previous); - ECORE_LIST(list)->index--; - } - else - _ecore_list_goto_last(ECORE_LIST(list)); + if (ECORE_LIST(list)->current) + { + data = ECORE_LIST(list)->current->data; + ECORE_LIST(list)->current = ECORE_LIST_NODE(ECORE_DLIST_NODE( + ECORE_LIST(list)->current)->previous); + ECORE_LIST(list)->index--; + } + else + _ecore_list_goto_last(ECORE_LIST(list)); - return data; + return data; } /** @@ -1477,13 +1544,14 @@ static void *_ecore_dlist_previous(Ecore_DList * list) * * @return Returns TRUE on success, FALSE on errors */ -EAPI int ecore_dlist_clear(Ecore_DList * list) +EAPI int +ecore_dlist_clear(Ecore_DList *list) { - CHECK_PARAM_POINTER_RETURN("list", list, FALSE); + CHECK_PARAM_POINTER_RETURN("list", list, FALSE); - ecore_list_clear(ECORE_LIST(list)); + ecore_list_clear(ECORE_LIST(list)); - return TRUE; + return TRUE; } /* @@ -1491,38 +1559,41 @@ EAPI int ecore_dlist_clear(Ecore_DList * list) * @param node: the node to initialize * @return Returns TRUE on success, FALSE on errors */ -EAPI int ecore_dlist_node_init(Ecore_DList_Node * node) +EAPI int +ecore_dlist_node_init(Ecore_DList_Node *node) { - int ret; + int ret; - CHECK_PARAM_POINTER_RETURN("node", node, FALSE); + CHECK_PARAM_POINTER_RETURN("node", node, FALSE); - ret = ecore_list_node_init(ECORE_LIST_NODE(node)); - if (ret) - node->previous = NULL; + ret = ecore_list_node_init(ECORE_LIST_NODE(node)); + if (ret) + node->previous = NULL; - return ret; + return ret; } /* * @brief Allocate and initialize a new list node * @return Returns NULL on error, new list node on success */ -EAPI Ecore_DList_Node *ecore_dlist_node_new() +EAPI Ecore_DList_Node * +ecore_dlist_node_new() { - Ecore_DList_Node *new_node; + Ecore_DList_Node *new_node; - new_node = malloc(sizeof(Ecore_DList_Node)); + new_node = malloc(sizeof(Ecore_DList_Node)); - if (!new_node) - return NULL; + if (!new_node) + return NULL; - if (!ecore_dlist_node_init(new_node)) { - FREE(new_node); - return NULL; - } + if (!ecore_dlist_node_init(new_node)) + { + FREE(new_node); + return NULL; + } - return new_node; + return new_node; } /* @@ -1531,10 +1602,10 @@ EAPI Ecore_DList_Node *ecore_dlist_node_new() * @param free_func: the callback function to execute on the data * @return Returns TRUE on success, FALSE on error */ -EAPI int ecore_dlist_node_destroy(Ecore_DList_Node * node, Ecore_Free_Cb free_func) +EAPI int +ecore_dlist_node_destroy(Ecore_DList_Node * node, Ecore_Free_Cb free_func) { - CHECK_PARAM_POINTER_RETURN("node", node, - FALSE); + CHECK_PARAM_POINTER_RETURN("node", node, FALSE); - return ecore_list_node_destroy(ECORE_LIST_NODE(node), free_func); + return ecore_list_node_destroy(ECORE_LIST_NODE(node), free_func); }