Return allocated variable in INIT()
This commit is contained in:
1 parent
f8437dd8d2
commit
e3c881aff9
1 file changed
+3
-2
@@ -121,8 +121,9 @@
|
||||
/**
|
||||
* Object allocation/initialization macro, using designated initializer.
|
||||
*/
|
||||
#define INIT(this, ...) { (this) = malloc(sizeof(*this)); \
|
||||
*(this) = (typeof(*this)){ __VA_ARGS__ }; }
|
||||
#define INIT(this, ...) ({ (this) = malloc(sizeof(*(this))); \
|
||||
*(this) = (typeof(*(this))){ __VA_ARGS__ }; \
|
||||
(this); })
|
||||
|
||||
/**
|
||||
* Method declaration/definition macro, providing private and public interface.
|
||||
|
||||
Reference in new issue
Block a user