Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
11425c89
Commit
11425c89
authored
Jul 25, 2015
by
antirez
Browse files
SDS: sdsjoinsds() call ported from antirez/sds fork.
parent
6b836b6b
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/sds.c
View file @
11425c89
...
@@ -1075,6 +1075,18 @@ sds sdsjoin(char **argv, int argc, char *sep) {
...
@@ -1075,6 +1075,18 @@ sds sdsjoin(char **argv, int argc, char *sep) {
return
join
;
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)
#if defined(REDIS_TEST) || defined(SDS_TEST_MAIN)
#include <stdio.h>
#include <stdio.h>
#include "testhelp.h"
#include "testhelp.h"
...
...
src/sds.h
View file @
11425c89
...
@@ -247,6 +247,7 @@ sds sdscatrepr(sds s, const char *p, size_t len);
...
@@ -247,6 +247,7 @@ sds sdscatrepr(sds s, const char *p, size_t len);
sds
*
sdssplitargs
(
const
char
*
line
,
int
*
argc
);
sds
*
sdssplitargs
(
const
char
*
line
,
int
*
argc
);
sds
sdsmapchars
(
sds
s
,
const
char
*
from
,
const
char
*
to
,
size_t
setlen
);
sds
sdsmapchars
(
sds
s
,
const
char
*
from
,
const
char
*
to
,
size_t
setlen
);
sds
sdsjoin
(
char
**
argv
,
int
argc
,
char
*
sep
);
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 */
/* Low level functions exposed to the user API */
sds
sdsMakeRoomFor
(
sds
s
,
size_t
addlen
);
sds
sdsMakeRoomFor
(
sds
s
,
size_t
addlen
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment