Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
b93a741f
Commit
b93a741f
authored
Nov 30, 2021
by
Dridi Boukelmoune
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vcc: Better format TOSTRANDS() C code
parent
7ead21cb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
5 deletions
+15
-5
vcc_expr.c
lib/libvcc/vcc_expr.c
+15
-5
No files found.
lib/libvcc/vcc_expr.c
View file @
b93a741f
...
...
@@ -148,6 +148,19 @@ vcc_delete_expr(struct expr *e)
* XXX: check line lengths in edit, should pass indent in for this
*/
static
void
vcc_strands_edit
(
struct
expr
*
e1
,
struct
expr
*
e2
)
{
if
(
e2
->
nstr
==
1
)
{
VSB_printf
(
e1
->
vsb
,
"TOSTRAND(%s)"
,
VSB_data
(
e2
->
vsb
));
return
;
}
VSB_printf
(
e1
->
vsb
,
"TOSTRANDS(%d,
\v
+
\n
%s
\v
-)"
,
e2
->
nstr
,
VSB_data
(
e2
->
vsb
));
}
static
struct
expr
*
vcc_expr_edit
(
struct
vcc
*
tl
,
vcc_type_t
fmt
,
const
char
*
p
,
struct
expr
*
e1
,
struct
expr
*
e2
)
...
...
@@ -179,9 +192,7 @@ vcc_expr_edit(struct vcc *tl, vcc_type_t fmt, const char *p, struct expr *e1,
if
(
e3
->
nstr
>
1
)
{
VSB_cat
(
e
->
vsb
,
"
\n
VRT_STRANDS_string(ctx,
\v
+
\n
"
);
VSB_printf
(
e
->
vsb
,
"TOSTRANDS(%d,%s)"
,
e3
->
nstr
,
VSB_data
(
e3
->
vsb
));
vcc_strands_edit
(
e
,
e3
);
VSB_cat
(
e
->
vsb
,
"
\v
-
\n
)
\n
"
);
}
else
{
...
...
@@ -192,8 +203,7 @@ vcc_expr_edit(struct vcc *tl, vcc_type_t fmt, const char *p, struct expr *e1,
case
't'
:
e3
=
(
*
p
==
'T'
?
e1
:
e2
);
AN
(
e3
);
VSB_printf
(
e
->
vsb
,
"TOSTRANDS(%d,%s)"
,
e3
->
nstr
,
VSB_data
(
e3
->
vsb
));
vcc_strands_edit
(
e
,
e3
);
break
;
case
'1'
:
VSB_cat
(
e
->
vsb
,
VSB_data
(
e1
->
vsb
));
...
...
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