aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sds.c6
-rw-r--r--sds.h2
2 files changed, 4 insertions, 4 deletions
diff --git a/sds.c b/sds.c
index 9bb86d8..745b4f2 100644
--- a/sds.c
+++ b/sds.c
@@ -352,7 +352,7 @@ sds sdscatprintf(sds s, const char *fmt, ...) {
*
* Output will be just "Hello World".
*/
-sds sdstrim(sds s, const char *cset) {
+void sdstrim(sds s, const char *cset) {
struct sdshdr *sh = (void*) (s-(sizeof(struct sdshdr)));
char *start, *end, *sp, *ep;
size_t len;
@@ -366,7 +366,6 @@ sds sdstrim(sds s, const char *cset) {
sh->buf[len] = '\0';
sh->free = sh->free+(sh->len-len);
sh->len = len;
- return s;
}
/* Turn the string into a smaller (or equal) string containing only the
@@ -807,7 +806,8 @@ int main(void) {
sdslen(x) == 3 && memcmp(x,"123\0",4) ==0)
sdsfree(x);
- x = sdstrim(sdsnew("xxciaoyyy"),"xy");
+ x = sdsnew("xxciaoyyy");
+ sdstrim(x,"xy");
test_cond("sdstrim() correctly trims characters",
sdslen(x) == 4 && memcmp(x,"ciao\0",5) == 0)
diff --git a/sds.h b/sds.h
index 569137a..a188fcc 100644
--- a/sds.h
+++ b/sds.h
@@ -76,7 +76,7 @@ sds sdscatprintf(sds s, const char *fmt, ...)
sds sdscatprintf(sds s, const char *fmt, ...);
#endif
-sds sdstrim(sds s, const char *cset);
+void sdstrim(sds s, const char *cset);
void sdsrange(sds s, int start, int end);
void sdsupdatelen(sds s);
void sdsclear(sds s);