forked from enlightenment/efl
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
This commit is contained in:
parent
9c9fa4d401
commit
1de1f6d8fb
|
@ -1488,7 +1488,7 @@ EAPI Eo *_efl_added_get(void);
|
|||
* @param ... The ops to run.
|
||||
* @return An handle to the new object on success, NULL otherwise.
|
||||
*/
|
||||
#define efl_new(klass, ...) efl_add_ref(klass, NULL, __VA_ARGS__)
|
||||
#define efl_new(klass, ...) efl_add_ref(klass, NULL, ##__VA_ARGS__)
|
||||
|
||||
EAPI Eo * _efl_add_internal_start(const char *file, int line, const Efl_Class *klass_id, Eo *parent, Eina_Bool ref, Eina_Bool is_fallback);
|
||||
|
||||
|
|
Loading…
Reference in New Issue