Return allocated variable in INIT()
authorMartin Willi <martin@revosec.ch>
Thu, 19 May 2011 11:42:17 +0000 (13:42 +0200)
committerMartin Willi <martin@revosec.ch>
Mon, 12 Sep 2011 11:03:20 +0000 (13:03 +0200)
src/libstrongswan/utils.h

index bef6f66..f04c633 100644 (file)
 /**
  * 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.