diff --git a/src/runtime/c/gu/string.c b/src/runtime/c/gu/string.c index 3e754a72c..386eb7a6f 100644 --- a/src/runtime/c/gu/string.c +++ b/src/runtime/c/gu/string.c @@ -82,6 +82,20 @@ gu_string_buf_freeze(GuStringBuf* sb, GuPool* pool) return p; } +char* +gu_string_buf_data(GuStringBuf* sb) +{ + gu_out_flush(sb->out, NULL); + return gu_buf_data(sb->buf); +} + +size_t +gu_string_buf_length(GuStringBuf* sb) +{ + gu_out_flush(sb->out, NULL); + return gu_buf_length(sb->buf); +} + void gu_string_buf_flush(GuStringBuf* sb) { diff --git a/src/runtime/c/gu/string.h b/src/runtime/c/gu/string.h index 17b932397..d52c9dddb 100644 --- a/src/runtime/c/gu/string.h +++ b/src/runtime/c/gu/string.h @@ -33,6 +33,12 @@ gu_string_buf_out(GuStringBuf* sb); GuString gu_string_buf_freeze(GuStringBuf* sb, GuPool* pool); +char* +gu_string_buf_data(GuStringBuf* sb); + +size_t +gu_string_buf_length(GuStringBuf* sb); + void gu_string_buf_flush(GuStringBuf* sb);