From 7465fa182f3ed748184ed7e10999a5e02f722aef Mon Sep 17 00:00:00 2001 From: ame Date: Thu, 29 Feb 2024 16:01:36 -0600 Subject: working on 'rolling' parsing --- src/types/str.c | 5 +++++ src/types/str.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src/types') diff --git a/src/types/str.c b/src/types/str.c index 2783fb0..12a6bb1 100644 --- a/src/types/str.c +++ b/src/types/str.c @@ -48,4 +48,9 @@ void str_clear(str* s){ s->len = 0; } +void str_popf(str* s, int len){ + memmove(s->c, s->c + len, s->len -= len); + s->c[s->len] = 0; +} + diff --git a/src/types/str.h b/src/types/str.h index ccf379f..54f27e6 100644 --- a/src/types/str.h +++ b/src/types/str.h @@ -16,5 +16,5 @@ void str_free(str*); void str_push(str*, char*); void str_pushl(str*, char*, size_t); void str_clear(str*); - +void str_popf(str*, int); #endif //__STR_H \ No newline at end of file -- cgit v1.2.3