diff options
Diffstat (limited to 'src/cklist.c')
-rw-r--r-- | src/cklist.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/cklist.c b/src/cklist.c index b2a7803..d22ee49 100644 --- a/src/cklist.c +++ b/src/cklist.c @@ -60,6 +60,17 @@ char* list_get(cklist *ckl) { return ckl->arr[ckl->pos]; } +char* list_get_at(cklist *ckl, int pos) { + if (ckl->pos == -1) { + return NULL; + } + if (ckl->pos >= ckl->size + || pos >= ckl->size) { + return NULL; + } + return ckl->arr[pos]; +} + void list_rewind(cklist *ckl) { ckl->pos = 0; } |