*/
/* Memory Pool */
+typedef struct _Eina_Mempool_Backend_ABI1 Eina_Mempool_Backend_ABI1;
+typedef struct _Eina_Mempool_Backend_ABI2 Eina_Mempool_Backend_ABI2;
+
struct _Eina_Mempool_Backend
{
const char *name;
void (*repack)(void *data, Eina_Mempool_Repack_Cb cb, void *cb_data);
};
+struct _Eina_Mempool_Backend_ABI1
+{
+ const char *name;
+ void *(*init)(const char *context, const char *options, va_list args);
+ void (*free)(void *data, void *element);
+ void *(*alloc)(void *data, unsigned int size);
+ void *(*realloc)(void *data, void *element, unsigned int size);
+ void (*garbage_collect)(void *data);
+ void (*statistics)(void *data);
+ void (*shutdown)(void *data);
+};
+
+struct _Eina_Mempool_Backend_ABI2
+{
+ void (*repack)(void *data, Eina_Mempool_Repack_Cb cb, void *cb_data);
+};
+
struct _Eina_Mempool
{
- Eina_Mempool_Backend backend;
+ Eina_Mempool_Backend_ABI1 backend;
void *backend_data;
+ Eina_Mempool_Backend_ABI2 backend2;
};
/**
if (!mp)
goto on_error;
- /* FIXME why backend is not a pointer? */
- mp->backend = *be;
+ /* Work around ABI incompability introduced in Eina 1.1 */
+#define SBP(Property) mp->backend.Property = be->Property;
+ SBP(name);
+ SBP(init);
+ SBP(free);
+ SBP(alloc);
+ SBP(realloc);
+ SBP(garbage_collect);
+ SBP(statistics);
+ SBP(shutdown);
+#undef SBP
+ mp->backend2.repack = be->repack;
+
mp->backend_data = mp->backend.init(context, options, args);
return mp;
EINA_SAFETY_ON_NULL_RETURN(mp);
EINA_SAFETY_ON_NULL_RETURN(mp->backend.shutdown);
DBG("mp=%p", mp);
- mp->backend.repack(mp->backend_data, cb, data);
+ mp->backend2.repack(mp->backend_data, cb, data);
}
EAPI void eina_mempool_gc(Eina_Mempool *mp)