Add a chunk_from_str() initializer that does not include 0-terminator
This commit is contained in:
@@ -190,6 +190,11 @@ static inline void chunk_clear(chunk_t *chunk)
|
|||||||
*/
|
*/
|
||||||
#define chunk_from_thing(thing) chunk_create((char*)&(thing), sizeof(thing))
|
#define chunk_from_thing(thing) chunk_create((char*)&(thing), sizeof(thing))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize a chunk from a static string, not containing 0-terminator
|
||||||
|
*/
|
||||||
|
#define chunk_from_str(str) chunk_create(str, strlen(str))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allocate a chunk on the heap
|
* Allocate a chunk on the heap
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user