fixed builder_cancel macro to return NULL on failed build
authorMartin Willi <martin@strongswan.org>
Mon, 6 Oct 2008 13:08:49 +0000 (13:08 -0000)
committerMartin Willi <martin@strongswan.org>
Mon, 6 Oct 2008 13:08:49 +0000 (13:08 -0000)
src/libstrongswan/credentials/builder.c
src/libstrongswan/credentials/builder.h

index c4f3d4f..4295b30 100644 (file)
@@ -37,3 +37,12 @@ ENUM(builder_part_names, BUILD_FROM_FILE, BUILD_END,
        "BUILD_X509_FLAG",
        "BUILD_END",
 );
+
+/**
+ * See header.
+ */
+void* builder_free(builder_t *this)
+{
+       free(this);
+       return NULL;
+}
index 8e0c513..cd75236 100644 (file)
@@ -118,6 +118,11 @@ struct builder_t {
  * Helper macro to cancel a build in a builder
  */
 #define builder_cancel(builder) { (builder)->add = (void*)nop; \
-                                                                 (builder)->build = (void*)free; }
+                                                                 (builder)->build = (void*)builder_free; }
+
+/**
+ * Helper function for a cancelled build.
+ */
+void* builder_free(builder_t *this);
 
 #endif /* BUILDER_H_ @}*/