From 29c291ff3b6d678c682bacce310366ef96ab23c5 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Thu, 9 Feb 2012 10:32:14 +0000 Subject: [PATCH] Eina model: Made i_method_resolve a macro (for interface as well) Same as the previous commit about "Type" this time about Interface. This will also hopefully remove the likelihood for hacks. Previous functions are still available as method_offset_resolve. SVN revision: 67786 --- legacy/eina/src/include/eina_model.h | 6 +++--- legacy/eina/src/lib/eina_model.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/legacy/eina/src/include/eina_model.h b/legacy/eina/src/include/eina_model.h index ebc3842d5a..9e5aa01169 100644 --- a/legacy/eina/src/include/eina_model.h +++ b/legacy/eina/src/include/eina_model.h @@ -961,9 +961,9 @@ EAPI Eina_Bool eina_model_interface_deep_copy(const Eina_Model_Interface *iface, const Eina_Model *src, Eina_Model *dst) EINA_ARG_NONNULL(1, 2, 3); -EAPI const void *eina_model_interface_method_resolve(const Eina_Model_Interface *iface, - const Eina_Model *model, - unsigned int offset) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT EINA_PURE; +#define eina_model_interface_method_resolve(iface, model, struct_type, method) eina_model_interface_method_offset_resolve((iface), (model), offsetof(struct_type, method)) + +EAPI const void *eina_model_interface_method_offset_resolve(const Eina_Model_Interface *iface, const Eina_Model *model, unsigned int offset) EINA_ARG_NONNULL(1, 2) EINA_WARN_UNUSED_RESULT EINA_PURE; struct _Eina_Model_Event_Description diff --git a/legacy/eina/src/lib/eina_model.c b/legacy/eina/src/lib/eina_model.c index 0b986b9a2f..de5de0b708 100644 --- a/legacy/eina/src/lib/eina_model.c +++ b/legacy/eina/src/lib/eina_model.c @@ -4829,8 +4829,8 @@ eina_model_interface_deep_copy(const Eina_Model_Interface *iface, const Eina_Mod return deep_copy(src, dst); } -EAPI const void * -eina_model_interface_method_resolve(const Eina_Model_Interface *iface, const Eina_Model *model, unsigned int offset) +EAPI const void +*eina_model_interface_method_offset_resolve(const Eina_Model_Interface *iface, const Eina_Model *model, unsigned int offset) { EINA_MODEL_INTERFACE_IMPLEMENTED_CHECK_VAL(iface, model, NULL); EINA_SAFETY_ON_FALSE_RETURN_VAL(offset >= sizeof(Eina_Model_Interface), NULL);