forked from enlightenment/efl
parent
3b2a46c239
commit
986b3ded31
|
@ -11,6 +11,7 @@ AM_CPPFLAGS = -I. \
|
|||
|
||||
noinst_LTLIBRARIES = libevas_data.la
|
||||
libevas_data_la_SOURCES = \
|
||||
evas_array_inline.x \
|
||||
evas_hash.c \
|
||||
evas_list.c \
|
||||
evas_array.c \
|
||||
|
|
|
@ -9,48 +9,7 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
#include "Evas_Data.h"
|
||||
|
||||
|
||||
#ifdef __GNUC__
|
||||
# define UNLIKELY(x) __builtin_expect(!!(x), 0)
|
||||
#else
|
||||
# define UNLIKELY(x) (x)
|
||||
#endif
|
||||
|
||||
|
||||
static Evas_Bool _evas_array_grow(Evas_Array *array);
|
||||
|
||||
static inline void
|
||||
_evas_array_append(Evas_Array *array, void *data)
|
||||
{
|
||||
if (UNLIKELY((array->count + array->step) > array->total))
|
||||
if (!_evas_array_grow(array)) return ;
|
||||
|
||||
array->data[array->count++] = data;
|
||||
}
|
||||
|
||||
static inline void*
|
||||
_evas_array_get(Evas_Array *array, unsigned int index)
|
||||
{
|
||||
return array->data[index];
|
||||
}
|
||||
|
||||
|
||||
static Evas_Bool
|
||||
_evas_array_grow(Evas_Array *array)
|
||||
{
|
||||
void **tmp;
|
||||
size_t total;
|
||||
|
||||
total = array->total + array->step;
|
||||
tmp = realloc(array->data, sizeof (void*) * total);
|
||||
if (!tmp) return 0;
|
||||
|
||||
array->total = total;
|
||||
array->data = tmp;
|
||||
|
||||
return 1;
|
||||
}
|
||||
#include "evas_inline_array.x"
|
||||
|
||||
EAPI void
|
||||
evas_array_append(Evas_Array *array, void *data)
|
||||
|
@ -58,7 +17,7 @@ evas_array_append(Evas_Array *array, void *data)
|
|||
_evas_array_append(array, data);
|
||||
}
|
||||
|
||||
EAPI void*
|
||||
EAPI void *
|
||||
evas_array_get(Evas_Array *array, unsigned int index)
|
||||
{
|
||||
return _evas_array_get(array, index);
|
||||
|
@ -86,7 +45,7 @@ evas_array_flush(Evas_Array *array)
|
|||
array->data = NULL;
|
||||
}
|
||||
|
||||
EAPI Evas_Array*
|
||||
EAPI Evas_Array *
|
||||
evas_array_new(unsigned int step)
|
||||
{
|
||||
Evas_Array *array;
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
#ifndef EVAS_INLINE_ARRAY_H
|
||||
#define EVAS_INLINE_ARRAY_H
|
||||
|
||||
#ifdef __GNUC__
|
||||
# define UNLIKELY(x) __builtin_expect(!!(x), 0)
|
||||
#else
|
||||
# define UNLIKELY(x) (x)
|
||||
#endif
|
||||
|
||||
static inline Evas_Bool
|
||||
_evas_array_grow(Evas_Array *array)
|
||||
{
|
||||
void **tmp;
|
||||
size_t total;
|
||||
|
||||
total = array->total + array->step;
|
||||
tmp = realloc(array->data, sizeof (void*) * total);
|
||||
if (!tmp) return 0;
|
||||
|
||||
array->total = total;
|
||||
array->data = tmp;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static inline void
|
||||
_evas_array_append(Evas_Array *array, void *data)
|
||||
{
|
||||
if (UNLIKELY((array->count + array->step) > array->total))
|
||||
if (!_evas_array_grow(array)) return ;
|
||||
|
||||
array->data[array->count++] = data;
|
||||
}
|
||||
|
||||
static inline void *
|
||||
_evas_array_get(Evas_Array *array, unsigned int index)
|
||||
{
|
||||
return array->data[index];
|
||||
}
|
||||
|
||||
#endif
|
|
@ -202,4 +202,6 @@ evas_object_clip_recalc(Evas_Object *obj)
|
|||
obj->cur.cache.clip.dirty = 0;
|
||||
}
|
||||
|
||||
#include "data/evas_inline_array.x"
|
||||
|
||||
#endif
|
||||
|
|
|
@ -740,8 +740,6 @@ EAPI int _evas_module_engine_inherit(Evas_Func *funcs, char *name);
|
|||
void evas_render_invalidate(Evas *e);
|
||||
void evas_render_object_recalc(Evas_Object *obj);
|
||||
|
||||
Evas_Bool _evas_array_grow(Evas_Array *array);
|
||||
|
||||
#define EVAS_API_OVERRIDE(func, api, prefix) \
|
||||
(api)->func = prefix##func
|
||||
|
||||
|
|
Loading…
Reference in New Issue