diff options
author | wrmr | 2024-11-09 02:21:35 -0500 |
---|---|---|
committer | wrmr | 2024-11-09 02:21:35 -0500 |
commit | 4ca7853b000048514f5bf18391db2e66f65d1377 (patch) | |
tree | cbb4450195c2ec813fc7689fd62a8524a657c8c5 /str.c | |
parent | 2780add3f90c284cbb08f2b3a2ad83aeb472d4e0 (diff) |
add strv_next
Diffstat (limited to 'str.c')
-rw-r--r-- | str.c | 9 |
1 files changed, 9 insertions, 0 deletions
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; + } +} |