diff options
author | Tobias Brunner <tobias@strongswan.org> | 2013-03-28 16:33:39 +0100 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2013-06-11 11:03:12 +0200 |
commit | c1be5d66cd68fbe7491532497f14a08992024c39 (patch) | |
tree | a8c639f039ae1e355131b18c8fa2df957f372cf1 | |
parent | 456a31e8957e5928c62a8e83460b10602335e99d (diff) | |
download | strongswan-c1be5d66cd68fbe7491532497f14a08992024c39.tar.bz2 strongswan-c1be5d66cd68fbe7491532497f14a08992024c39.tar.xz |
Use local variable in chunk_from_str()
This allows using strdup() or other string functions as argument
without calling them twice.
-rw-r--r-- | src/libstrongswan/utils/chunk.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libstrongswan/utils/chunk.h b/src/libstrongswan/utils/chunk.h index cfda6ee77..b9f2bf266 100644 --- a/src/libstrongswan/utils/chunk.h +++ b/src/libstrongswan/utils/chunk.h @@ -191,9 +191,9 @@ static inline void chunk_clear(chunk_t *chunk) #define chunk_from_thing(thing) chunk_create((char*)&(thing), sizeof(thing)) /** - * Initialize a chunk from a static string, not containing 0-terminator + * Initialize a chunk from a string, not containing 0-terminator */ -#define chunk_from_str(str) chunk_create(str, strlen(str)) +#define chunk_from_str(str) ({char *x = (str); chunk_create(x, strlen(x));}) /** * Allocate a chunk on the heap |