summaryrefslogtreecommitdiff
path: root/src/runtime/c
diff options
context:
space:
mode:
authorkr.angelov <kr.angelov@gmail.com>2013-06-22 15:39:47 +0000
committerkr.angelov <kr.angelov@gmail.com>2013-06-22 15:39:47 +0000
commit9058ccb3ebe0d6042d40dc9806bb9a7d5464c8d7 (patch)
treef886fb2f59f37808f4a3f04d7c89ffdc4d50e81e /src/runtime/c
parentfa7ac00838827672f5c4a08dd1a37021285326e6 (diff)
bugfix for the word completion in the C runtime
Diffstat (limited to 'src/runtime/c')
-rw-r--r--src/runtime/c/gu/string.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/runtime/c/gu/string.c b/src/runtime/c/gu/string.c
index 7dc90e1e3..7ffd43068 100644
--- a/src/runtime/c/gu/string.c
+++ b/src/runtime/c/gu/string.c
@@ -352,12 +352,16 @@ gu_string_is_prefix(GuString s1, GuString s2)
str2 = (char*) &p[1];
}
- while (sz1 > 0 && sz2 > 0) {
+
+ if (sz1 > sz2)
+ return false;
+
+ for (size_t sz = sz1; sz--; sz > 0) {
if (*str1 != *str2)
return false;
- str1++; sz1--;
- str2++; sz2--;
+ str1++;
+ str2++;
}
return true;