summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2016-03-09 15:06:49 +0000
committerTom Hacohen <tom@stosb.com>2016-03-09 16:09:14 +0000
commitb85bb3718389470bfc78c079dd5e06def5e963f3 (patch)
tree3cd20d191157023f33403d30fedd1cfcc5ef83c7 /src
parent2d0d2802bfaba6a98caa31537daf528449f1091a (diff)
Eo: Change to the Eo4 eo_add syntax.
The current one was a hack in the meanwhile and was not protable.
Diffstat (limited to 'src')
-rw-r--r--src/lib/eo/Eo.h18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/lib/eo/Eo.h b/src/lib/eo/Eo.h
index 387f187..a6e4f96 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);
610 */ 610 */
611EAPI const Eo_Class *eo_class_get(const Eo *obj); 611EAPI const Eo_Class *eo_class_get(const Eo *obj);
612 612
613#define _eo_add_common(klass, parent, is_ref, ...) \ 613#define _eo_add_common(objp, klass, parent, is_ref, ...) \
614 ({ \ 614 ((Eo *) ( \
615 Eo * const eoid = _eo_add_internal_start(__FILE__, __LINE__, klass, parent, is_ref); \ 615 *objp = _eo_add_internal_start(__FILE__, __LINE__, klass, parent, is_ref), \
616 __VA_ARGS__; \ 616 ##__VA_ARGS__, \
617 (Eo *) _eo_add_end(eoid); \ 617 *objp = _eo_add_end(*objp) \
618 }) 618 ))
619 619
620/** 620/**
621 * @def eo_add 621 * @def eo_add
@@ -631,12 +631,13 @@ EAPI const Eo_Class *eo_class_get(const Eo *obj);
631 * 631 *
632 * If you want a more "consistent" behaviour, take a look at #eo_add_ref. 632 * If you want a more "consistent" behaviour, take a look at #eo_add_ref.
633 * 633 *
634 * @param objp a pointer to the object id (Eo **)
634 * @param klass the class of the object to create. 635 * @param klass the class of the object to create.
635 * @param parent the parent to set to the object. 636 * @param parent the parent to set to the object.
636 * @param ... The ops to run. 637 * @param ... The ops to run.
637 * @return An handle to the new object on success, NULL otherwise. 638 * @return An handle to the new object on success, NULL otherwise.
638 */ 639 */
639#define eo_add(klass, parent, ...) _eo_add_common(klass, parent, EINA_FALSE, ##__VA_ARGS__) 640#define eo_add(objp, klass, parent, ...) _eo_add_common(objp, klass, parent, EINA_FALSE, ##__VA_ARGS__)
640 641
641/** 642/**
642 * @def eo_add_ref 643 * @def eo_add_ref
@@ -648,12 +649,13 @@ EAPI const Eo_Class *eo_class_get(const Eo *obj);
648 * when the parent object is deleted until you manually remove the ref 649 * when the parent object is deleted until you manually remove the ref
649 * by calling eo_unref(). 650 * by calling eo_unref().
650 * 651 *
652 * @param objp a pointer to the object id (Eo **)
651 * @param klass the class of the object to create. 653 * @param klass the class of the object to create.
652 * @param parent the parent to set to the object. 654 * @param parent the parent to set to the object.
653 * @param ... The ops to run. 655 * @param ... The ops to run.
654 * @return An handle to the new object on success, NULL otherwise. 656 * @return An handle to the new object on success, NULL otherwise.
655 */ 657 */
656#define eo_add_ref(klass, parent, ...) _eo_add_common(klass, parent, EINA_TRUE, ##__VA_ARGS__) 658#define eo_add_ref(objp, klass, parent, ...) _eo_add_common(objp, klass, parent, EINA_TRUE, ##__VA_ARGS__)
657 659
658EAPI Eo * _eo_add_internal_start(const char *file, int line, const Eo_Class *klass_id, Eo *parent, Eina_Bool ref); 660EAPI Eo * _eo_add_internal_start(const char *file, int line, const Eo_Class *klass_id, Eo *parent, Eina_Bool ref);
659 661