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
ee721f1e
Commit
ee721f1e
authored
May 14, 2013
by
antirez
Browse files
CONFIG REWRITE: strip multiple empty lines.
parent
c184f36d
Changes
1
Show whitespace changes
Inline
Side-by-side
src/config.c
View file @
ee721f1e
...
@@ -1397,11 +1397,20 @@ void rewriteConfigClientoutputbufferlimitOption(struct rewriteConfigState *state
...
@@ -1397,11 +1397,20 @@ void rewriteConfigClientoutputbufferlimitOption(struct rewriteConfigState *state
}
}
}
}
/* Glue together the configuration lines in the current configuration
* rewrite state into a single string, stripping multiple empty lines. */
sds
rewriteConfigGetContentFromState
(
struct
rewriteConfigState
*
state
)
{
sds
rewriteConfigGetContentFromState
(
struct
rewriteConfigState
*
state
)
{
sds
content
=
sdsempty
();
sds
content
=
sdsempty
();
int
j
;
int
j
,
was_empty
=
0
;
for
(
j
=
0
;
j
<
state
->
numlines
;
j
++
)
{
for
(
j
=
0
;
j
<
state
->
numlines
;
j
++
)
{
/* Every cluster of empty lines is turned into a single empty line. */
if
(
sdslen
(
state
->
lines
[
j
])
==
0
)
{
if
(
was_empty
)
continue
;
was_empty
=
1
;
}
else
{
was_empty
=
0
;
}
content
=
sdscatsds
(
content
,
state
->
lines
[
j
]);
content
=
sdscatsds
(
content
,
state
->
lines
[
j
]);
content
=
sdscatlen
(
content
,
"
\n
"
,
1
);
content
=
sdscatlen
(
content
,
"
\n
"
,
1
);
}
}
...
...
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