summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrochen <liuql_mobiler@163.com>2014-12-10 11:19:13 +0800
committerBrochen <liuql_mobiler@163.com>2014-12-10 11:19:13 +0800
commit181300d4a7506f7214538178ed79b8f57a49be8a (patch)
treefdb6ad8158d08a8cdebcaeccc8fb2d8cbc398365 /src
parentd2aa91ce1f5431f8df4499010e6f6dd742bd2531 (diff)
downloadredis-181300d4a7506f7214538178ed79b8f57a49be8a.tar.gz
Update sds.c
in the case (all chars of the string s found in 'cset' ), line[573] will no more do the same thing line[572] did. this will be more faster especially in the case that the string s is very long and all chars of string s found in 'cset'
Diffstat (limited to 'src')
-rw-r--r--src/sds.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/sds.c b/src/sds.c
index 5a3bc82b1..11f560ad7 100644
--- a/src/sds.c
+++ b/src/sds.c
@@ -570,7 +570,7 @@ sds sdstrim(sds s, const char *cset) {
sp = start = s;
ep = end = s+sdslen(s)-1;
while(sp <= end && strchr(cset, *sp)) sp++;
- while(ep > start && strchr(cset, *ep)) ep--;
+ while(ep > sp && strchr(cset, *ep)) ep--;
len = (sp > ep) ? 0 : ((ep-sp)+1);
if (sh->buf != sp) memmove(sh->buf, sp, len);
sh->buf[len] = '\0';