summaryrefslogtreecommitdiff
path: root/userland/libc/tb
diff options
context:
space:
mode:
Diffstat (limited to 'userland/libc/tb')
-rw-r--r--userland/libc/tb/sv.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/userland/libc/tb/sv.c b/userland/libc/tb/sv.c
index 3f947ef..4ff24fb 100644
--- a/userland/libc/tb/sv.c
+++ b/userland/libc/tb/sv.c
@@ -11,6 +11,15 @@ char *SV_TO_C(struct sv s) {
return c_string;
}
+size_t sv_to_cstring_buffer(struct sv s, char *buffer, size_t length) {
+ if (0 == length || length - 1 < s.length) {
+ return s.length;
+ }
+ memcpy(buffer, s.s, s.length);
+ buffer[s.length] = '\0';
+ return s.length;
+}
+
struct sv sv_next(struct sv s) {
if (0 == s.length) {
return s;