summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavi Artigas <xavierartigas@yahoo.es>2018-07-12 09:32:22 -0400
committerMike Blumenkrantz <zmike@samsung.com>2018-07-12 09:32:42 -0400
commit1de1f6d8fb4674f5ea419548a276173f00f12ad7 (patch)
tree174e70e9f9a77c2e88e48bb577128f54428821e2
parent9c9fa4d40187082c4d1361213790aaf678225235 (diff)
eo: Fix efl_new without initializing parameters
Summary: efl_new(CLASS), i.e., without initializers, never worked before. The problem is the dangling comma: efl_add_ref(klass, NULL, ); Fortunately the C preprocessor concatenation operator # # has a special case just for this occasion: When you do A ## B, and A is a comma and B is empty, it removes also A. https://gcc.gnu.org/onlinedocs/cpp/Variadic-Macros.html This trick is already in use in several other EFL headers using variadic macros. Reviewers: zmike, bu5hm4n, devilhorns, herdsman Reviewed By: zmike Subscribers: cedric, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D6553
-rw-r--r--src/lib/eo/Eo.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lib/eo/Eo.h b/src/lib/eo/Eo.h
index 6f85481392..727ebde297 100644
--- a/src/lib/eo/Eo.h
+++ b/src/lib/eo/Eo.h
@@ -1488,7 +1488,7 @@ EAPI Eo *_efl_added_get(void);
1488 * @param ... The ops to run. 1488 * @param ... The ops to run.
1489 * @return An handle to the new object on success, NULL otherwise. 1489 * @return An handle to the new object on success, NULL otherwise.
1490 */ 1490 */
1491#define efl_new(klass, ...) efl_add_ref(klass, NULL, __VA_ARGS__) 1491#define efl_new(klass, ...) efl_add_ref(klass, NULL, ##__VA_ARGS__)
1492 1492
1493EAPI Eo * _efl_add_internal_start(const char *file, int line, const Efl_Class *klass_id, Eo *parent, Eina_Bool ref, Eina_Bool is_fallback); 1493EAPI Eo * _efl_add_internal_start(const char *file, int line, const Efl_Class *klass_id, Eo *parent, Eina_Bool ref, Eina_Bool is_fallback);
1494 1494