diff options
Diffstat (limited to 'src/util/util.c')
-rw-r--r-- | src/util/util.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/util/util.c b/src/util/util.c index 4f79870..c113377 100644 --- a/src/util/util.c +++ b/src/util/util.c @@ -64,6 +64,26 @@ size_t kai_text_to_longs(long *dest, const char *str, size_t count) } +size_t kai_text_to_uints(unsigned int *dest, const char *str, size_t count) +{ + char *nptr = (char*) str; + char *end; + + size_t result = count; + + int i; + for (i=0; i<count; i++) { + dest[i] = strtol(nptr, &end, 10); + if (nptr == end) { + result -= 1; + } + nptr = end; + } + + return result; +} + + void *kai_alloc(size_t size, const char *purpose) { void *buf = malloc(size); |