From 4ca7853b000048514f5bf18391db2e66f65d1377 Mon Sep 17 00:00:00 2001 From: wrmr Date: Sat, 9 Nov 2024 02:21:35 -0500 Subject: add strv_next --- str.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'str.c') diff --git a/str.c b/str.c index 10d64e1..e0ea194 100644 --- a/str.c +++ b/str.c @@ -58,3 +58,12 @@ int strv_split(strv_t *src, int chr, strv_t *dest) { src->n -= dest->n + !!c; return dest->n > 0; } + +char strv_next(strv_t *s) { + if (s->n > 0) { + s->n--; + return *(s->s++); + } else { + return 0; + } +} -- cgit 1.4.1-2-gfad0