From 971e0d9e845bfcb14fcf175d72a136c4e1186f6c Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Wed, 17 Dec 2014 22:53:55 +0100 Subject: [PATCH] utils/strbuf: Added SDB_STRBUF_STR. This macro returns a tuple describing the buffer content and length. The idea is that functions which operate on (binary) strings should accept two such arguments and the macro will make it easier to pass them in. --- src/include/utils/strbuf.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/include/utils/strbuf.h b/src/include/utils/strbuf.h index c14192d..a9e9155 100644 --- a/src/include/utils/strbuf.h +++ b/src/include/utils/strbuf.h @@ -45,6 +45,13 @@ extern "C" { typedef struct sdb_strbuf sdb_strbuf_t; +/* + * SDB_STRBUF_STR: + * Return a tuple of a character array and its length representing the content + * of the string buffer. + */ +#define SDB_STRBUF_STR(buf) sdb_strbuf_string(buf), sdb_strbuf_len(buf) + /* * sdb_strbuf_create, sdb_strbuf_destroy: * Allocate / deallocate string buffer objects. The initial size of a newly -- 2.30.2