summaryrefslogtreecommitdiffstats
path: root/core/membuffer.c
diff options
context:
space:
mode:
Diffstat (limited to 'core/membuffer.c')
-rw-r--r--core/membuffer.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/core/membuffer.c b/core/membuffer.c
index 548b70d45..8efb04c9e 100644
--- a/core/membuffer.c
+++ b/core/membuffer.c
@@ -12,7 +12,8 @@
#include "dive.h"
#include "membuffer.h"
-char *detach_buffer(struct membuffer *b)
+/* Only for internal use */
+static char *detach_buffer(struct membuffer *b)
{
char *result = b->buffer;
b->buffer = NULL;
@@ -21,6 +22,12 @@ char *detach_buffer(struct membuffer *b)
return result;
}
+char *detach_cstring(struct membuffer *b)
+{
+ mb_cstring(b);
+ return detach_buffer(b);
+}
+
void free_buffer(struct membuffer *b)
{
free(detach_buffer(b));
@@ -117,8 +124,7 @@ char *vformat_string(const char *fmt, va_list args)
{
struct membuffer mb = { 0 };
put_vformat(&mb, fmt, args);
- mb_cstring(&mb);
- return detach_buffer(&mb);
+ return detach_cstring(&mb);
}
char *format_string(const char *fmt, ...)