diff options
author | Tom Hacohen <tom@stosb.com> | 2016-03-09 15:06:49 +0000 |
---|---|---|
committer | Tom Hacohen <tom@stosb.com> | 2016-03-09 16:09:14 +0000 |
commit | b85bb3718389470bfc78c079dd5e06def5e963f3 (patch) | |
tree | 3cd20d191157023f33403d30fedd1cfcc5ef83c7 | |
parent | 2d0d2802bfaba6a98caa31537daf528449f1091a (diff) | |
download | efl-b85bb3718389470bfc78c079dd5e06def5e963f3.tar.gz |
Eo: Change to the Eo4 eo_add syntax.
The current one was a hack in the meanwhile and was not protable.
-rw-r--r-- | src/lib/eo/Eo.h | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/lib/eo/Eo.h b/src/lib/eo/Eo.h index 387f187714..a6e4f960cd 100644 --- a/src/lib/eo/Eo.h +++ b/src/lib/eo/Eo.h @@ -610,12 +610,12 @@ EAPI Eo *eo_super(const Eo *obj, const Eo_Class *cur_klass); */ EAPI const Eo_Class *eo_class_get(const Eo *obj); -#define _eo_add_common(klass, parent, is_ref, ...) \ - ({ \ - Eo * const eoid = _eo_add_internal_start(__FILE__, __LINE__, klass, parent, is_ref); \ - __VA_ARGS__; \ - (Eo *) _eo_add_end(eoid); \ - }) +#define _eo_add_common(objp, klass, parent, is_ref, ...) \ + ((Eo *) ( \ + *objp = _eo_add_internal_start(__FILE__, __LINE__, klass, parent, is_ref), \ + ##__VA_ARGS__, \ + *objp = _eo_add_end(*objp) \ + )) /** * @def eo_add @@ -631,12 +631,13 @@ EAPI const Eo_Class *eo_class_get(const Eo *obj); * * If you want a more "consistent" behaviour, take a look at #eo_add_ref. * + * @param objp a pointer to the object id (Eo **) * @param klass the class of the object to create. * @param parent the parent to set to the object. * @param ... The ops to run. * @return An handle to the new object on success, NULL otherwise. */ -#define eo_add(klass, parent, ...) _eo_add_common(klass, parent, EINA_FALSE, ##__VA_ARGS__) +#define eo_add(objp, klass, parent, ...) _eo_add_common(objp, klass, parent, EINA_FALSE, ##__VA_ARGS__) /** * @def eo_add_ref @@ -648,12 +649,13 @@ EAPI const Eo_Class *eo_class_get(const Eo *obj); * when the parent object is deleted until you manually remove the ref * by calling eo_unref(). * + * @param objp a pointer to the object id (Eo **) * @param klass the class of the object to create. * @param parent the parent to set to the object. * @param ... The ops to run. * @return An handle to the new object on success, NULL otherwise. */ -#define eo_add_ref(klass, parent, ...) _eo_add_common(klass, parent, EINA_TRUE, ##__VA_ARGS__) +#define eo_add_ref(objp, klass, parent, ...) _eo_add_common(objp, klass, parent, EINA_TRUE, ##__VA_ARGS__) EAPI Eo * _eo_add_internal_start(const char *file, int line, const Eo_Class *klass_id, Eo *parent, Eina_Bool ref); |