mirror of
https://github.com/fluencelabs/redis
synced 2025-03-18 16:40:50 +00:00
SDS: sdsjoinsds() call ported from antirez/sds fork.
This commit is contained in:
parent
6b836b6b41
commit
11425c89cf
12
src/sds.c
12
src/sds.c
@ -1075,6 +1075,18 @@ sds sdsjoin(char **argv, int argc, char *sep) {
|
||||
return join;
|
||||
}
|
||||
|
||||
/* Like sdsjoin, but joins an array of SDS strings. */
|
||||
sds sdsjoinsds(sds *argv, int argc, const char *sep, size_t seplen) {
|
||||
sds join = sdsempty();
|
||||
int j;
|
||||
|
||||
for (j = 0; j < argc; j++) {
|
||||
join = sdscatsds(join, argv[j]);
|
||||
if (j != argc-1) join = sdscatlen(join,sep,seplen);
|
||||
}
|
||||
return join;
|
||||
}
|
||||
|
||||
#if defined(REDIS_TEST) || defined(SDS_TEST_MAIN)
|
||||
#include <stdio.h>
|
||||
#include "testhelp.h"
|
||||
|
@ -247,6 +247,7 @@ sds sdscatrepr(sds s, const char *p, size_t len);
|
||||
sds *sdssplitargs(const char *line, int *argc);
|
||||
sds sdsmapchars(sds s, const char *from, const char *to, size_t setlen);
|
||||
sds sdsjoin(char **argv, int argc, char *sep);
|
||||
sds sdsjoinsds(sds *argv, int argc, const char *sep, size_t seplen);
|
||||
|
||||
/* Low level functions exposed to the user API */
|
||||
sds sdsMakeRoomFor(sds s, size_t addlen);
|
||||
|
Loading…
x
Reference in New Issue
Block a user