diff options
Diffstat (limited to 'src/cklist.c')
-rw-r--r-- | src/cklist.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/src/cklist.c b/src/cklist.c index 2fdfa07..f255556 100644 --- a/src/cklist.c +++ b/src/cklist.c @@ -50,19 +50,13 @@ int list_next(cklist *ckl) { } char* list_get(cklist *ckl) { - if (ckl->pos == -1) { - return NULL; - } if (ckl->pos >= ckl->size) { return NULL; } return ckl->arr[ckl->pos]; } -char* list_get_at(cklist *ckl, int pos) { - if (ckl->pos == -1) { - return NULL; - } +char* list_get_at(cklist *ckl, unsigned int pos) { if (ckl->pos >= ckl->size || pos >= ckl->size) { return NULL; @@ -94,7 +88,7 @@ cklist* list_move(cklist *ckl) { return _ckl; } -cklist* list_copy_from(cklist *ckl, int index) { +cklist* list_copy_from(cklist *ckl,unsigned int index) { list_rewind(ckl); cklist *_ckl = list_make_new(); if (ckl->pos >= index) { @@ -109,7 +103,7 @@ cklist* list_copy_from(cklist *ckl, int index) { return _ckl; } -cklist* list_copy_until(cklist *ckl, int index) { +cklist* list_copy_until(cklist *ckl,unsigned int index) { list_rewind(ckl); cklist *_ckl = list_make_and_add(list_get(ckl)); while(list_next(ckl)) { @@ -121,7 +115,7 @@ cklist* list_copy_until(cklist *ckl, int index) { return _ckl; } -cklist* list_copy_part(cklist *ckl, int from, int until) { +cklist* list_copy_part(cklist *ckl,unsigned int from,unsigned int until) { list_rewind(ckl); cklist *_ckl = list_make_new(); if (ckl->pos >= from && ckl->pos < until) { @@ -185,7 +179,7 @@ void list_print_concat(cklist *ckl) { } } -int list_exists(cklist *ckl, char *str) { +int list_exists(cklist *ckl, const char *str) { if (ckl->size > 0) { list_rewind(ckl); do { @@ -197,12 +191,12 @@ int list_exists(cklist *ckl, char *str) { return 0; } -int list_size(cklist *ckl) { +unsigned int list_size(cklist *ckl) { return ckl->size; } void list_free(cklist *ckl) { - int i; + unsigned int i; for (i=0; i<ckl->size; i++) { free(ckl->arr[i]); } |