summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 3bca9aa)
raw | patch | inline | side by side (parent: 3bca9aa)
author | Sebastian Harl <sh@tokkee.org> | |
Fri, 13 Dec 2013 13:44:54 +0000 (14:44 +0100) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Fri, 13 Dec 2013 13:44:54 +0000 (14:44 +0100) |
src/client/sysdb.c | patch | blob | history | |
src/include/utils/strbuf.h | patch | blob | history | |
src/utils/strbuf.c | patch | blob | history |
diff --git a/src/client/sysdb.c b/src/client/sysdb.c
index aa791385cba8fabcb92b4a8810e91820f26b12a5..ada0ec3ae30f5dba633265eee73a2db937118a3c 100644 (file)
--- a/src/client/sysdb.c
+++ b/src/client/sysdb.c
#include "client/sysdb.h"
#include "client/sock.h"
#include "utils/error.h"
+#include "utils/strbuf.h"
#include <errno.h>
index 900a4530511020ae9c5d8374b065c943922c23ad..96b4f86bee3aa8937899a9af08314f9fa5866860 100644 (file)
void
sdb_strbuf_skip(sdb_strbuf_t *strbuf, size_t offset, size_t n);
+/*
+ * sdb_strbuf_clear:
+ * Clear the buffer but do not deallocate memory.
+ */
+void
+sdb_strbuf_clear(sdb_strbuf_t *strbuf);
+
/*
* sdb_strbuf_string:
* Returns the content of the string buffer. The caller may not modify the
diff --git a/src/utils/strbuf.c b/src/utils/strbuf.c
index 6190e3a8a045a650c26067a0d637003bf321ded9..ee419b7ea20994efaeeaac3d6ae1d246c402dcb0 100644 (file)
--- a/src/utils/strbuf.c
+++ b/src/utils/strbuf.c
strbuf->string[strbuf->pos] = '\0';
} /* sdb_strbuf_skip */
+void
+sdb_strbuf_clear(sdb_strbuf_t *strbuf)
+{
+ if ((! strbuf) || (! strbuf->size))
+ return;
+
+ strbuf->string[0] = '\0';
+ strbuf->pos = 0;
+} /* sdb_strbuf_clear */
+
const char *
sdb_strbuf_string(sdb_strbuf_t *strbuf)
{