diff options
Diffstat (limited to 'src/lib/eina_graph_private.h')
-rw-r--r-- | src/lib/eina_graph_private.h | 42 |
1 files changed, 9 insertions, 33 deletions
diff --git a/src/lib/eina_graph_private.h b/src/lib/eina_graph_private.h index 1c4ea86..1925cf7 100644 --- a/src/lib/eina_graph_private.h +++ b/src/lib/eina_graph_private.h @@ -60,36 +60,6 @@ extern int _eina_graph_log_dom; #endif #define DBG(...) EINA_LOG_DOM_DBG(_eina_graph_log_dom, __VA_ARGS__) -typedef struct _Eina_Graph_Adjacents -{ - unsigned int *data; - unsigned int total; - unsigned int count; -} _Eina_Graph_Adjacents; - -static inline void -eina_graph_adjacents_free(_Eina_Graph_Adjacents *adjs) -{ - if (adjs->data) - free(adjs->data); - adjs->data = NULL; -} - -Eina_Bool -_eina_graph_adjacents_grow(_Eina_Graph_Adjacents *adjs, unsigned int step); - -static inline Eina_Bool -eina_graph_adjacents_push(_Eina_Graph_Adjacents *adjs, unsigned int v, unsigned int step) -{ - if (EINA_UNLIKELY((adjs->count + 1) > adjs->total)) - if (!_eina_graph_adjacents_grow(adjs, step)) - return EINA_FALSE; - - adjs->data[adjs->count++] = v; - - return EINA_TRUE; -} - static inline Eina_Bool eina_array_push_uint(Eina_Array *array, unsigned int v) { @@ -103,10 +73,17 @@ eina_array_push_uint(Eina_Array *array, unsigned int v) } static inline unsigned int +eina_array_uint_nth_get(const Eina_Array *array, unsigned int idx) +{ + return (unsigned int) (uintptr_t) + eina_array_data_get(array, idx); +} + +static inline unsigned int eina_array_top_uint_get(const Eina_Array *array) { return (unsigned int) (uintptr_t) - eina_array_data_get(array,eina_array_count_get(array) - 1 ); + eina_array_data_get(array, eina_array_count_get(array) - 1 ); } /*+ @@ -118,8 +95,7 @@ typedef struct _Eina_Graph { unsigned int vertices; unsigned int edges; - unsigned int step; - _Eina_Graph_Adjacents *adjs; + Eina_Array *adjs[]; } _Eina_Graph; typedef struct _Eina_Graph_DFS_Data |