diff options
author | gramanas <anastasis.gramm2@gmail.com> | 2018-05-14 01:14:15 +0300 |
---|---|---|
committer | gramanas <anastasis.gramm2@gmail.com> | 2018-05-14 01:14:15 +0300 |
commit | 68efbf97390ddac355c3b54a5d825e74fb4b208d (patch) | |
tree | e5884bf3650708c683b134792db3756d28c5b697 /src/cklist.c | |
parent | fb7e3e1352aeca03909ae3720c8cae90fcd57186 (diff) | |
download | ck-68efbf97390ddac355c3b54a5d825e74fb4b208d.tar.gz ck-68efbf97390ddac355c3b54a5d825e74fb4b208d.tar.bz2 ck-68efbf97390ddac355c3b54a5d825e74fb4b208d.zip |
small fixes
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; } |