aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Löthberg <johannes@kyriasis.com>2015-01-18 15:51:30 +0100
committerJohannes Löthberg <johannes@kyriasis.com>2015-01-19 00:25:41 +0100
commit6aa8c1d8976ad3a609f6600966ad48582d024d5e (patch)
treefbd67401f0acf4ff910d9dc0dac9f1910e1d8c74
parent021b386ddac3384643d9342683cb448047f83a1a (diff)
downloadsds-6aa8c1d8976ad3a609f6600966ad48582d024d5e.tar.xz
sdssplitlen: Change length arguments to size_t
-rw-r--r--src/sds.c6
-rw-r--r--src/sds.h2
2 files changed, 4 insertions, 4 deletions
diff --git a/src/sds.c b/src/sds.c
index e68a401..aee013f 100644
--- a/src/sds.c
+++ b/src/sds.c
@@ -472,11 +472,11 @@ int sdscmp(const sds s1, const sds s2) {
* requires length arguments. sdssplit() is just the
* same function but for zero-terminated strings.
*/
-sds *sdssplitlen(const char *s, int len, const char *sep, int seplen, int *count) {
- int elements = 0, slots = 5, start = 0, j;
+sds *sdssplitlen(const char *s, size_t len, const char *sep, size_t seplen, size_t *count) {
+ size_t elements = 0, slots = 5, start = 0, j;
sds *tokens;
- if (seplen < 1 || len < 0) { return NULL; }
+ if (seplen < 1) { return NULL; }
tokens = malloc(sizeof(sds)*slots);
if (tokens == NULL) { return NULL; }
diff --git a/src/sds.h b/src/sds.h
index d0830fe..13c94de 100644
--- a/src/sds.h
+++ b/src/sds.h
@@ -83,7 +83,7 @@ void sdsrange(sds s, ptrdiff_t start, ptrdiff_t end);
void sdsupdatelen(sds s);
void sdsclear(sds s);
int sdscmp(const sds s1, const sds s2);
-sds *sdssplitlen(const char *s, int len, const char *sep, int seplen, int *count);
+sds *sdssplitlen(const char *s, size_t len, const char *sep, size_t seplen, size_t *count);
void sdsfreesplitres(sds *tokens, int count);
void sdstolower(sds s);
void sdstoupper(sds s);