summaryrefslogtreecommitdiff
path: root/src/lib/eo/Eo.h
diff options
context:
space:
mode:
authorTom Hacohen <tom@stosb.com>2016-03-11 12:24:11 +0000
committerTom Hacohen <tom@stosb.com>2016-03-11 12:29:04 +0000
commit8a56f5c98e04bdb945cc9ef82d24d0bf9c52f62c (patch)
tree19a8410945ed3422aa089c4f1001695100605ea6 /src/lib/eo/Eo.h
parent66b4290d917caa3fe8726d345cbde7a17611c257 (diff)
Revert "Eo: Change to the Eo4 eo_add syntax."
I found a way to keep eo_add() the way it was and gracefully degrade to a portable (but not as fast) solution for compilers that don't support the compound macros returning a value gnu extension: ({int a; a;}). I'm reverting these changes now, and I'll introduce the fallback as soon as I can. This reverts commit b85bb3718389470bfc78c079dd5e06def5e963f3.
Diffstat (limited to '')
-rw-r--r--src/lib/eo/Eo.h18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/lib/eo/Eo.h b/src/lib/eo/Eo.h
index a6e4f960cd..387f187714 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(objp, klass, parent, is_ref, ...) \ 613#define _eo_add_common(klass, parent, is_ref, ...) \
614 ((Eo *) ( \ 614 ({ \
615 *objp = _eo_add_internal_start(__FILE__, __LINE__, klass, parent, is_ref), \ 615 Eo * const eoid = _eo_add_internal_start(__FILE__, __LINE__, klass, parent, is_ref); \
616 ##__VA_ARGS__, \ 616 __VA_ARGS__; \
617 *objp = _eo_add_end(*objp) \ 617 (Eo *) _eo_add_end(eoid); \
618 )) 618 })
619 619
620/** 620/**
621 * @def eo_add 621 * @def eo_add
@@ -631,13 +631,12 @@ 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 **)
635 * @param klass the class of the object to create. 634 * @param klass the class of the object to create.
636 * @param parent the parent to set to the object. 635 * @param parent the parent to set to the object.
637 * @param ... The ops to run. 636 * @param ... The ops to run.
638 * @return An handle to the new object on success, NULL otherwise. 637 * @return An handle to the new object on success, NULL otherwise.
639 */ 638 */
640#define eo_add(objp, klass, parent, ...) _eo_add_common(objp, klass, parent, EINA_FALSE, ##__VA_ARGS__) 639#define eo_add(klass, parent, ...) _eo_add_common(klass, parent, EINA_FALSE, ##__VA_ARGS__)
641 640
642/** 641/**
643 * @def eo_add_ref 642 * @def eo_add_ref
@@ -649,13 +648,12 @@ EAPI const Eo_Class *eo_class_get(const Eo *obj);
649 * when the parent object is deleted until you manually remove the ref 648 * when the parent object is deleted until you manually remove the ref
650 * by calling eo_unref(). 649 * by calling eo_unref().
651 * 650 *
652 * @param objp a pointer to the object id (Eo **)
653 * @param klass the class of the object to create. 651 * @param klass the class of the object to create.
654 * @param parent the parent to set to the object. 652 * @param parent the parent to set to the object.
655 * @param ... The ops to run. 653 * @param ... The ops to run.
656 * @return An handle to the new object on success, NULL otherwise. 654 * @return An handle to the new object on success, NULL otherwise.
657 */ 655 */
658#define eo_add_ref(objp, klass, parent, ...) _eo_add_common(objp, klass, parent, EINA_TRUE, ##__VA_ARGS__) 656#define eo_add_ref(klass, parent, ...) _eo_add_common(klass, parent, EINA_TRUE, ##__VA_ARGS__)
659 657
660EAPI Eo * _eo_add_internal_start(const char *file, int line, const Eo_Class *klass_id, Eo *parent, Eina_Bool ref); 658EAPI Eo * _eo_add_internal_start(const char *file, int line, const Eo_Class *klass_id, Eo *parent, Eina_Bool ref);
661 659