From 9b43e8552adb46f10976b3bf90ee14d23d068bf7 Mon Sep 17 00:00:00 2001 From: cedric Date: Mon, 11 Apr 2011 17:45:01 +0000 Subject: [PATCH] eina: restore ABI compatibility. NOTE: if you did update the EFL during the last 3 hours, you will need to recompile them all at once. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/eina@58561 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- src/include/eina_inline_mempool.x | 23 ++++++++++++++++++++++- src/lib/eina_mempool.c | 17 ++++++++++++++--- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/src/include/eina_inline_mempool.x b/src/include/eina_inline_mempool.x index 72e70fe..e9f20b5 100644 --- a/src/include/eina_inline_mempool.x +++ b/src/include/eina_inline_mempool.x @@ -26,6 +26,9 @@ */ /* 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; @@ -39,10 +42,28 @@ struct _Eina_Mempool_Backend 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; }; /** diff --git a/src/lib/eina_mempool.c b/src/lib/eina_mempool.c index ddeabca..32a6831 100644 --- a/src/lib/eina_mempool.c +++ b/src/lib/eina_mempool.c @@ -80,8 +80,19 @@ _new_va(const char *name, 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; @@ -324,7 +335,7 @@ EAPI void eina_mempool_repack(Eina_Mempool *mp, Eina_Mempool_Repack_Cb cb, void 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) -- 2.7.4