From: Sebastian Harl Date: Wed, 17 Dec 2014 21:53:55 +0000 (+0100) Subject: utils/strbuf: Added SDB_STRBUF_STR. X-Git-Tag: sysdb-0.7.0~103 X-Git-Url: https://git.tokkee.org/?p=sysdb.git;a=commitdiff_plain;h=971e0d9e845bfcb14fcf175d72a136c4e1186f6c 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. --- 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