added chunk_from_thing() macro
authorMartin Willi <martin@strongswan.org>
Thu, 29 Mar 2007 11:06:59 +0000 (11:06 -0000)
committerMartin Willi <martin@strongswan.org>
Thu, 29 Mar 2007 11:06:59 +0000 (11:06 -0000)
src/libstrongswan/chunk.h

index 9880ae2..e4e816f 100644 (file)
@@ -89,6 +89,11 @@ void chunk_free(chunk_t *chunk);
 #define chunk_from_buf(str) { str, sizeof(str) }
 
 /**
+ * Initialize a chunk to point to a thing
+ */
+#define chunk_from_thing(thing) chunk_create((char*)&(thing), sizeof(thing))
+
+/**
  * Allocate a chunk on the heap
  */
 #define chunk_alloc(bytes) chunk_create(malloc(bytes), bytes)