Commit 6a378dc3 authored by Salvatore Sanfilippo's avatar Salvatore Sanfilippo
Browse files

Merge pull request #2203 from Brochen/unstable

Update sds.c
parents d2aa91ce 181300d4
...@@ -570,7 +570,7 @@ sds sdstrim(sds s, const char *cset) { ...@@ -570,7 +570,7 @@ sds sdstrim(sds s, const char *cset) {
sp = start = s; sp = start = s;
ep = end = s+sdslen(s)-1; ep = end = s+sdslen(s)-1;
while(sp <= end && strchr(cset, *sp)) sp++; 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); len = (sp > ep) ? 0 : ((ep-sp)+1);
if (sh->buf != sp) memmove(sh->buf, sp, len); if (sh->buf != sp) memmove(sh->buf, sp, len);
sh->buf[len] = '\0'; sh->buf[len] = '\0';
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment