Changeset: 6427af22cc87 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6427af22cc87
Modified Files:
monetdb5/modules/atoms/str.c
Branch: Dec2016
Log Message:
Use size_t for strlen.
diffs (47 lines):
diff --git a/monetdb5/modules/atoms/str.c b/monetdb5/modules/atoms/str.c
--- a/monetdb5/modules/atoms/str.c
+++ b/monetdb5/modules/atoms/str.c
@@ -1831,8 +1831,8 @@ STRReverseStrSearch(int *res, const str
str
STRsplitpart(str *res, str *haystack, str *needle, int *field)
{
- size_t slen;
- int len, f = *field;
+ size_t len;
+ int f = *field;
char *p;
const char *s = *haystack;
const char *s2 = *needle;
@@ -1848,10 +1848,10 @@ STRsplitpart(str *res, str *haystack, st
throw(MAL, "str.splitpart", "field position must be greater
than zero");
}
- slen = strlen(s2);
+ len = strlen(s2);
while ((p = strstr(s, s2)) != 0 && f > 1) {
- s = p + slen;
+ s = p + len;
f--;
}
@@ -1861,16 +1861,16 @@ STRsplitpart(str *res, str *haystack, st
throw(MAL, "str.splitpart", MAL_MALLOC_FAIL);
return MAL_SUCCEED;
}
-
+
if (p == 0) {
len = strlen(s);
} else if ((p = strstr(s, s2)) != 0) {
- len = (int) (p - s);
+ len = (size_t) (p - s);
} else {
len = strlen(s);
}
- if (len == int_nil || len == 0) {
+ if (len == 0) {
*res = GDKstrdup("");
if (*res == NULL)
throw(MAL, "str.splitpart", MAL_MALLOC_FAIL);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list