diff options
author | gramanas <anastasis.gramm2@gmail.com> | 2018-10-26 16:00:29 +0300 |
---|---|---|
committer | gramanas <anastasis.gramm2@gmail.com> | 2018-10-26 16:02:07 +0300 |
commit | 41ae1a0f0d86d2fc19f333ee23889c11beb0a4dd (patch) | |
tree | b29207e44aa8dcc10ef2deb51ac1514fb934c420 /src/cklist.c | |
parent | a6b2b4b2a4095d2f95419df986378e54432c2d71 (diff) | |
download | ck-41ae1a0f0d86d2fc19f333ee23889c11beb0a4dd.tar.gz ck-41ae1a0f0d86d2fc19f333ee23889c11beb0a4dd.tar.bz2 ck-41ae1a0f0d86d2fc19f333ee23889c11beb0a4dd.zip |
Confort to pedantic std-c99 and update readme
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]); } |