From 68efbf97390ddac355c3b54a5d825e74fb4b208d Mon Sep 17 00:00:00 2001 From: gramanas Date: Mon, 14 May 2018 01:14:15 +0300 Subject: small fixes --- src/cklist.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/cklist.c') 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; } -- cgit v1.2.3