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
5de5efa3
Commit
5de5efa3
authored
Mar 06, 2013
by
antirez
Browse files
sds.c: sdssplitargs_free() removed as it was a duplicate.
parent
1f2d5941
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/sds.c
View file @
5de5efa3
...
@@ -475,8 +475,10 @@ int hex_digit_to_int(char c) {
...
@@ -475,8 +475,10 @@ int hex_digit_to_int(char c) {
* foo bar "newline are supported\n" and "\xff\x00otherstuff"
* foo bar "newline are supported\n" and "\xff\x00otherstuff"
*
*
* The number of arguments is stored into *argc, and an array
* The number of arguments is stored into *argc, and an array
* of sds is returned. The caller should sdsfree() all the returned
* of sds is returned.
* strings and finally zfree() the array itself.
*
* The caller should free the resulting array of sds strings with
* sdsfreesplitres().
*
*
* Note that sdscatrepr() is able to convert back a string into
* Note that sdscatrepr() is able to convert back a string into
* a quoted string in the same format sdssplitargs() is able to parse.
* a quoted string in the same format sdssplitargs() is able to parse.
...
@@ -581,8 +583,7 @@ sds *sdssplitargs(const char *line, int *argc) {
...
@@ -581,8 +583,7 @@ sds *sdssplitargs(const char *line, int *argc) {
(
*
argc
)
++
;
(
*
argc
)
++
;
current
=
NULL
;
current
=
NULL
;
}
else
{
}
else
{
/* Even on empty input string returns something not NULL that
/* Even on empty input string return something not NULL. */
* can be freed by sdssplitargs_free. */
if
(
vector
==
NULL
)
vector
=
zmalloc
(
sizeof
(
void
*
));
if
(
vector
==
NULL
)
vector
=
zmalloc
(
sizeof
(
void
*
));
return
vector
;
return
vector
;
}
}
...
@@ -597,13 +598,6 @@ err:
...
@@ -597,13 +598,6 @@ err:
return
NULL
;
return
NULL
;
}
}
void
sdssplitargs_free
(
sds
*
argv
,
int
argc
)
{
int
j
;
for
(
j
=
0
;
j
<
argc
;
j
++
)
sdsfree
(
argv
[
j
]);
zfree
(
argv
);
}
/* Modify the string substituting all the occurrences of the set of
/* Modify the string substituting all the occurrences of the set of
* characters specified in the 'from' string to the corresponding character
* characters specified in the 'from' string to the corresponding character
* in the 'to' array.
* in the 'to' array.
...
...
src/sds.h
View file @
5de5efa3
...
@@ -88,7 +88,6 @@ void sdstoupper(sds s);
...
@@ -88,7 +88,6 @@ void sdstoupper(sds s);
sds
sdsfromlonglong
(
long
long
value
);
sds
sdsfromlonglong
(
long
long
value
);
sds
sdscatrepr
(
sds
s
,
const
char
*
p
,
size_t
len
);
sds
sdscatrepr
(
sds
s
,
const
char
*
p
,
size_t
len
);
sds
*
sdssplitargs
(
const
char
*
line
,
int
*
argc
);
sds
*
sdssplitargs
(
const
char
*
line
,
int
*
argc
);
void
sdssplitargs_free
(
sds
*
argv
,
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
);
/* Low level functions exposed to the user API */
/* Low level functions exposed to the user API */
...
...
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