EAPI void
edje_cache_emp_alloc(Edje_Part_Collection_Directory_Entry *ce)
-{ /* Init Eina Mempools this is also used in edje_pick.c */
- char *buffer;
-#define INIT_EMP(Tp, Sz, Ce) \
- buffer = alloca(strlen(ce->entry) + strlen(#Tp) + 2); \
- sprintf(buffer, "%s/%s", ce->entry, #Tp); \
- Ce->mp.Tp = eina_mempool_add("one_big", buffer, NULL, sizeof (Sz), Ce->count.Tp); \
- _emp_##Tp = Ce->mp.Tp;
-
-#define INIT_EMP_BOTH(Tp, Sz, Ce) \
- INIT_EMP(Tp, Sz, Ce) \
- Ce->mp_rtl.Tp = eina_mempool_add("one_big", buffer, NULL, \
- sizeof (Sz), Ce->count.Tp);
+{
+ /* Init Eina Mempools this is also used in edje_pick.c */
+ char *buffer;
+ ce->mp = calloc(1, sizeof(Edje_Part_Collection_Directory_Entry_Mp));
+ if (!ce->mp) return;
+
+#define INIT_EMP(Tp, Sz, Ce) \
+ buffer = alloca(strlen(ce->entry) + strlen(#Tp) + 2); \
+ sprintf(buffer, "%s/%s", ce->entry, #Tp); \
+ Ce->mp->mp.Tp = eina_mempool_add("one_big", buffer, NULL, sizeof (Sz), Ce->count.Tp); \
+ _emp_##Tp = Ce->mp->mp.Tp;
+
+#define INIT_EMP_BOTH(Tp, Sz, Ce) \
+ INIT_EMP(Tp, Sz, Ce) \
+ Ce->mp->mp_rtl.Tp = eina_mempool_add("one_big", buffer, NULL, \
+ sizeof(Sz), Ce->count.Tp);
INIT_EMP_BOTH(RECTANGLE, Edje_Part_Description_Common, ce);
INIT_EMP_BOTH(TEXT, Edje_Part_Description_Text, ce);
edje_cache_emp_free(Edje_Part_Collection_Directory_Entry *ce)
{ /* Free Eina Mempools this is also used in edje_pick.c */
/* Destroy all part and description. */
- eina_mempool_del(ce->mp.RECTANGLE);
- eina_mempool_del(ce->mp.TEXT);
- eina_mempool_del(ce->mp.IMAGE);
- eina_mempool_del(ce->mp.PROXY);
- eina_mempool_del(ce->mp.SWALLOW);
- eina_mempool_del(ce->mp.TEXTBLOCK);
- eina_mempool_del(ce->mp.GROUP);
- eina_mempool_del(ce->mp.BOX);
- eina_mempool_del(ce->mp.TABLE);
- eina_mempool_del(ce->mp.EXTERNAL);
- eina_mempool_del(ce->mp.SPACER);
- eina_mempool_del(ce->mp.SNAPSHOT);
- eina_mempool_del(ce->mp.MESH_NODE);
- eina_mempool_del(ce->mp.LIGHT);
- eina_mempool_del(ce->mp.CAMERA);
- eina_mempool_del(ce->mp.VECTOR);
- eina_mempool_del(ce->mp.part);
- memset(&ce->mp, 0, sizeof (ce->mp));
-
- eina_mempool_del(ce->mp_rtl.RECTANGLE);
- eina_mempool_del(ce->mp_rtl.TEXT);
- eina_mempool_del(ce->mp_rtl.IMAGE);
- eina_mempool_del(ce->mp_rtl.PROXY);
- eina_mempool_del(ce->mp_rtl.SWALLOW);
- eina_mempool_del(ce->mp_rtl.TEXTBLOCK);
- eina_mempool_del(ce->mp_rtl.GROUP);
- eina_mempool_del(ce->mp_rtl.BOX);
- eina_mempool_del(ce->mp_rtl.TABLE);
- eina_mempool_del(ce->mp_rtl.EXTERNAL);
- eina_mempool_del(ce->mp_rtl.SPACER);
- eina_mempool_del(ce->mp_rtl.SNAPSHOT);
- eina_mempool_del(ce->mp_rtl.MESH_NODE);
- eina_mempool_del(ce->mp_rtl.LIGHT);
- eina_mempool_del(ce->mp_rtl.CAMERA);
- memset(&ce->mp_rtl, 0, sizeof (ce->mp_rtl));
- ce->ref = NULL;
+ ce->ref = NULL;
+
+ if (!ce->mp) return;
+ eina_mempool_del(ce->mp->mp.RECTANGLE);
+ eina_mempool_del(ce->mp->mp.TEXT);
+ eina_mempool_del(ce->mp->mp.IMAGE);
+ eina_mempool_del(ce->mp->mp.PROXY);
+ eina_mempool_del(ce->mp->mp.SWALLOW);
+ eina_mempool_del(ce->mp->mp.TEXTBLOCK);
+ eina_mempool_del(ce->mp->mp.GROUP);
+ eina_mempool_del(ce->mp->mp.BOX);
+ eina_mempool_del(ce->mp->mp.TABLE);
+ eina_mempool_del(ce->mp->mp.EXTERNAL);
+ eina_mempool_del(ce->mp->mp.SPACER);
+ eina_mempool_del(ce->mp->mp.SNAPSHOT);
+ eina_mempool_del(ce->mp->mp.MESH_NODE);
+ eina_mempool_del(ce->mp->mp.LIGHT);
+ eina_mempool_del(ce->mp->mp.CAMERA);
+ eina_mempool_del(ce->mp->mp.VECTOR);
+ eina_mempool_del(ce->mp->mp.part);
+ memset(&ce->mp->mp, 0, sizeof(ce->mp->mp));
+
+ eina_mempool_del(ce->mp->mp_rtl.RECTANGLE);
+ eina_mempool_del(ce->mp->mp_rtl.TEXT);
+ eina_mempool_del(ce->mp->mp_rtl.IMAGE);
+ eina_mempool_del(ce->mp->mp_rtl.PROXY);
+ eina_mempool_del(ce->mp->mp_rtl.SWALLOW);
+ eina_mempool_del(ce->mp->mp_rtl.TEXTBLOCK);
+ eina_mempool_del(ce->mp->mp_rtl.GROUP);
+ eina_mempool_del(ce->mp->mp_rtl.BOX);
+ eina_mempool_del(ce->mp->mp_rtl.TABLE);
+ eina_mempool_del(ce->mp->mp_rtl.EXTERNAL);
+ eina_mempool_del(ce->mp->mp_rtl.SPACER);
+ eina_mempool_del(ce->mp->mp_rtl.SNAPSHOT);
+ eina_mempool_del(ce->mp->mp_rtl.MESH_NODE);
+ eina_mempool_del(ce->mp->mp_rtl.LIGHT);
+ eina_mempool_del(ce->mp->mp_rtl.CAMERA);
+ memset(&ce->mp->mp_rtl, 0, sizeof(ce->mp->mp_rtl));
}
void
case EDJE_PART_TYPE_##Short: \
{ \
Edje_Part_Description_##Type * Name; \
- Name = eina_mempool_malloc(ce->mp_rtl.Short, \
+ Name = eina_mempool_malloc(ce->mp->mp_rtl.Short, \
sizeof (Edje_Part_Description_##Type)); \
desc_rtl = &Name->common; \
memsize = sizeof(Edje_Part_Description_##Type); \
switch (type)
{
case EDJE_PART_TYPE_RECTANGLE:
- desc_rtl = eina_mempool_malloc(ce->mp_rtl.RECTANGLE,
+ desc_rtl = eina_mempool_malloc(ce->mp->mp_rtl.RECTANGLE,
sizeof (Edje_Part_Description_Common));
ce->count.RECTANGLE++;
memsize = sizeof(Edje_Part_Description_Common);
break;
case EDJE_PART_TYPE_SNAPSHOT:
- desc_rtl = eina_mempool_malloc(ce->mp_rtl.SNAPSHOT,
+ desc_rtl = eina_mempool_malloc(ce->mp->mp_rtl.SNAPSHOT,
sizeof (Edje_Part_Description_Snapshot));
ce->count.SNAPSHOT++;
memsize = sizeof(Edje_Part_Description_Snapshot);
break;
case EDJE_PART_TYPE_SWALLOW:
- desc_rtl = eina_mempool_malloc(ce->mp_rtl.SWALLOW,
+ desc_rtl = eina_mempool_malloc(ce->mp->mp_rtl.SWALLOW,
sizeof (Edje_Part_Description_Common));
ce->count.SWALLOW++;
memsize = sizeof(Edje_Part_Description_Common);
break;
case EDJE_PART_TYPE_GROUP:
- desc_rtl = eina_mempool_malloc(ce->mp_rtl.GROUP,
+ desc_rtl = eina_mempool_malloc(ce->mp->mp_rtl.GROUP,
sizeof (Edje_Part_Description_Common));
ce->count.GROUP++;
memsize = sizeof(Edje_Part_Description_Common);
break;
case EDJE_PART_TYPE_SPACER:
- desc_rtl = eina_mempool_malloc(ce->mp_rtl.SPACER,
+ desc_rtl = eina_mempool_malloc(ce->mp->mp_rtl.SPACER,
sizeof (Edje_Part_Description_Common));
ce->count.SPACER++;
memsize = sizeof(Edje_Part_Description_Common);
_mempools_add(Edje_Part_Collection_Directory_Entry *de)
{
#define EDIT_EMN(Tp, Sz, Ce) \
- Ce->mp.Tp = eina_mempool_add("chained_mempool", #Tp, NULL, sizeof (Sz), 8);
+ Ce->mp->mp.Tp = eina_mempool_add("chained_mempool", #Tp, NULL, sizeof (Sz), 8);
#define EDIT_EMNP(Tp, Sz, Ce) \
- Ce->mp_rtl.Tp = eina_mempool_add("chained_mempool", #Tp, NULL, sizeof (Sz), 8);
+ Ce->mp->mp_rtl.Tp = eina_mempool_add("chained_mempool", #Tp, NULL, sizeof (Sz), 8);
EDIT_EMN(RECTANGLE, Edje_Part_Description_Common, de);
EDIT_EMN(TEXT, Edje_Part_Description_Text, de);
ce = eina_hash_find(ed->file->collection, ed->group);
/* Alloc Edje_Part or return */
- ep = eina_mempool_malloc(ce->mp.part, sizeof(Edje_Part));
+ ep = eina_mempool_malloc(ce->mp->mp.part, sizeof(Edje_Part));
if (!ep) return EINA_FALSE;
memset(ep, 0, sizeof(Edje_Part));
rp = eina_mempool_malloc(_edje_real_part_mp, sizeof(Edje_Real_Part));
if (!rp)
{
- eina_mempool_free(ce->mp.part, ep);
+ eina_mempool_free(ce->mp->mp.part, ep);
return EINA_FALSE;
}
memset(rp, 0, sizeof(Edje_Real_Part));
tmp = realloc(pc->parts, (pc->parts_count + 1) * sizeof (Edje_Part *));
if (!tmp)
{
- eina_mempool_free(ce->mp.part, ep);
+ eina_mempool_free(ce->mp->mp.part, ep);
eina_mempool_free(_edje_real_part_mp, rp);
return EINA_FALSE;
}
_edje_if_string_free(ed, &ep->name);
if (source)
_edje_if_string_free(ed, &ep->source);
- eina_mempool_free(ce->mp.part, ep);
+ eina_mempool_free(ce->mp->mp.part, ep);
eina_mempool_free(_edje_real_part_mp, rp);
return EINA_FALSE;
}
_edje_collection_free_part_description_free(ep->type, ep->other.desc[k], ce, 0);
free(ep->other.desc);
- eina_mempool_free(ce->mp.part, ep);
+ eina_mempool_free(ce->mp->mp.part, ep);
/* Free Edje_Real_Part */
_edje_real_part_free(ed, rp);
switch (type)
{
case EDJE_PART_TYPE_RECTANGLE:
- pd = eina_mempool_malloc(ce->mp.RECTANGLE, sizeof (Edje_Part_Description_Common));
+ pd = eina_mempool_malloc(ce->mp->mp.RECTANGLE, sizeof (Edje_Part_Description_Common));
ce->count.RECTANGLE++;
break;
case EDJE_PART_TYPE_SPACER:
- pd = eina_mempool_malloc(ce->mp.SPACER, sizeof (Edje_Part_Description_Common));
+ pd = eina_mempool_malloc(ce->mp->mp.SPACER, sizeof (Edje_Part_Description_Common));
ce->count.SPACER++;
break;
case EDJE_PART_TYPE_SWALLOW:
- pd = eina_mempool_malloc(ce->mp.SWALLOW, sizeof (Edje_Part_Description_Common));
+ pd = eina_mempool_malloc(ce->mp->mp.SWALLOW, sizeof (Edje_Part_Description_Common));
ce->count.SWALLOW++;
break;
case EDJE_PART_TYPE_GROUP:
- pd = eina_mempool_malloc(ce->mp.GROUP, sizeof (Edje_Part_Description_Common));
+ pd = eina_mempool_malloc(ce->mp->mp.GROUP, sizeof (Edje_Part_Description_Common));
ce->count.GROUP++;
break;
{ \
Edje_Part_Description_##Type * Name; \
\
- Name = eina_mempool_malloc(ce->mp.Short, \
+ Name = eina_mempool_malloc(ce->mp->mp.Short, \
sizeof (Edje_Part_Description_##Type)); \
memset(Name, 0, sizeof(Edje_Part_Description_##Type)); \
pd = &Name->common; \
// technically need this - but we ASSUME we use "one_big" so everything gets
// freed in one go lower down when we del the mempool... but what if pool goes
// "over"?
- eina_mempool_free(ce->mp.part, ep);
+ eina_mempool_free(ce->mp->mp.part, ep);
}
free(ec->parts);
ec->parts = NULL;
Edje_Part_Collection_Directory_Entry *ce,
Eina_Bool free_strings)
{
-#define FREE_POOL(Type, Ce, Desc) \
-case EDJE_PART_TYPE_##Type: eina_mempool_free(Ce->mp.Type, Desc); \
- ce->count.Type--; \
+#define FREE_POOL(Type, Ce, Desc) \
+case EDJE_PART_TYPE_##Type: eina_mempool_free(ce->mp->mp.Type, Desc); \
+ ce->count.Type--; \
break;
_edje_collection_free_part_description_clean(type, desc, free_strings);
TYPE SNAPSHOT; \
TYPE VECTOR;
+typedef struct _Edje_Part_Collection_Directory_Entry_Mp Edje_Part_Collection_Directory_Entry_Mp;
+
+struct _Edje_Part_Collection_Directory_Entry_Mp
+{
+ struct
+ {
+ PART_TYPE_FIELDS(Eina_Mempool *)
+ Eina_Mempool *part;
+ } mp;
+
+ struct
+ {
+ PART_TYPE_FIELDS(Eina_Mempool *)
+ } mp_rtl; /* For Right To Left interface */
+};
+
struct _Edje_Part_Collection_Directory_Entry
{
const char *entry; /* the nominal name of the part collection */
Edje_Part_Collection *ref;
+ Edje_Part_Collection_Directory_Entry_Mp *mp;
+
struct
{
PART_TYPE_FIELDS(int)
int id; /* the id of this named part collection */
- struct
- {
- PART_TYPE_FIELDS(Eina_Mempool *)
- Eina_Mempool *part;
- } mp;
-
- struct
- {
- PART_TYPE_FIELDS(Eina_Mempool *)
- } mp_rtl; /* For Right To Left interface */
-
Eina_Bool group_alias;
};