aboutsummaryrefslogtreecommitdiff
path: root/text.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2016-12-22 16:16:38 +0100
committerMarc André Tanner <mat@brain-dump.org>2016-12-23 10:39:04 +0100
commit58001e979af57701e36c58e0b36ea5f79246b012 (patch)
tree7a4935bfba45aa1350bd4a26b4bb53e8218bd72e /text.c
parent25f5a92cd32d62b3c8496af9083e8222c858efaf (diff)
downloadvis-58001e979af57701e36c58e0b36ea5f79246b012.tar.gz
vis-58001e979af57701e36c58e0b36ea5f79246b012.tar.xz
text: make text_vprintf static, it is only used within text.c
Diffstat (limited to 'text.c')
-rw-r--r--text.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/text.c b/text.c
index 0084ae3..f6e924b 100644
--- a/text.c
+++ b/text.c
@@ -637,6 +637,19 @@ bool text_insert(Text *txt, size_t pos, const char *data, size_t len) {
return true;
}
+static bool text_vprintf(Text *txt, size_t pos, const char *format, va_list ap) {
+ va_list ap_save;
+ va_copy(ap_save, ap);
+ int len = vsnprintf(NULL, 0, format, ap);
+ if (len == -1)
+ return false;
+ char *buf = malloc(len+1);
+ bool ret = buf && (vsnprintf(buf, len+1, format, ap_save) == len) && text_insert(txt, pos, buf, len);
+ free(buf);
+ va_end(ap_save);
+ return ret;
+}
+
bool text_appendf(Text *txt, const char *format, ...) {
va_list ap;
va_start(ap, format);
@@ -653,19 +666,6 @@ bool text_printf(Text *txt, size_t pos, const char *format, ...) {
return ret;
}
-bool text_vprintf(Text *txt, size_t pos, const char *format, va_list ap) {
- va_list ap_save;
- va_copy(ap_save, ap);
- int len = vsnprintf(NULL, 0, format, ap);
- if (len == -1)
- return false;
- char *buf = malloc(len+1);
- bool ret = buf && (vsnprintf(buf, len+1, format, ap_save) == len) && text_insert(txt, pos, buf, len);
- free(buf);
- va_end(ap_save);
- return ret;
-}
-
size_t text_insert_newline(Text *txt, size_t pos) {
const char *data = text_newline_char(txt);
size_t len = strlen(data);