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
b5033c59
Commit
b5033c59
authored
Apr 10, 2018
by
Nils Goroll
Committed by
Dridi Boukelmoune
Jun 19, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use an anonymous struct to pass the argstruct to vmod functions
... to save stack space Fixes #2643
parent
62817798
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
16 deletions
+11
-16
vcc_expr.c
lib/libvcc/vcc_expr.c
+11
-16
No files found.
lib/libvcc/vcc_expr.c
View file @
b5033c59
...
...
@@ -467,7 +467,6 @@ vcc_func(struct vcc *tl, struct expr **e, const void *priv,
const
struct
vjsn_val
*
vv
,
*
vvp
;
const
char
*
sa
;
char
ssa
[
64
];
char
ssa2
[
64
];
int
n
;
CAST_OBJ_NOTNULL
(
vv
,
priv
,
VJSN_VAL_MAGIC
);
...
...
@@ -481,10 +480,6 @@ vcc_func(struct vcc *tl, struct expr **e, const void *priv,
sa
=
vv
->
value
;
if
(
*
sa
==
'\0'
)
{
sa
=
NULL
;
}
else
{
bprintf
(
ssa
,
"args_%u"
,
tl
->
unique
++
);
VSB_printf
(
tl
->
curproc
->
prologue
,
" %s %s;
\n
"
,
sa
,
ssa
);
sa
=
ssa
;
}
vv
=
VTAILQ_NEXT
(
vv
,
list
);
SkipToken
(
tl
,
'('
);
...
...
@@ -572,27 +567,28 @@ vcc_func(struct vcc *tl, struct expr **e, const void *priv,
}
if
(
sa
!=
NULL
)
e1
=
vcc_mk_expr
(
rfmt
,
"%s(ctx%s,
\v
+(
\n
"
,
cfunc
,
extra
);
e1
=
vcc_mk_expr
(
rfmt
,
"%s(ctx%s,
\v
+ &(%s){
\n
"
,
cfunc
,
extra
,
sa
);
else
e1
=
vcc_mk_expr
(
rfmt
,
"%s(ctx%s
\v
+"
,
cfunc
,
extra
);
n
=
0
;
VTAILQ_FOREACH_SAFE
(
fa
,
&
head
,
list
,
fa2
)
{
n
++
;
if
(
fa
->
optional
)
VSB_printf
(
tl
->
curproc
->
prologue
,
" %s.valid_%s = %d;
\n
"
,
sa
,
fa
->
name
,
fa
->
avail
);
if
(
fa
->
optional
)
{
bprintf
(
ssa
,
"
\v
1.valid_%s = %d,
\n
"
,
fa
->
name
,
fa
->
avail
);
e1
=
vcc_expr_edit
(
tl
,
e1
->
fmt
,
ssa
,
e1
,
NULL
);
}
if
(
fa
->
result
==
NULL
&&
fa
->
type
==
ENUM
&&
fa
->
val
!=
NULL
)
vcc_do_enum
(
tl
,
fa
,
strlen
(
fa
->
val
),
fa
->
val
);
if
(
fa
->
result
==
NULL
&&
fa
->
val
!=
NULL
)
fa
->
result
=
vcc_mk_expr
(
fa
->
type
,
"%s"
,
fa
->
val
);
if
(
fa
->
result
!=
NULL
&&
sa
!=
NULL
)
{
if
(
fa
->
name
&&
*
fa
->
name
!=
'\0'
)
bprintf
(
ssa2
,
"
\v
1%s.%s =
\v
2,
\n
"
,
sa
,
fa
->
name
);
bprintf
(
ssa
,
"
\v
1.%s =
\v
2,
\n
"
,
fa
->
name
);
else
bprintf
(
ssa2
,
"
\v
1%s.arg%d =
\v
2,
\n
"
,
sa
,
n
);
e1
=
vcc_expr_edit
(
tl
,
e1
->
fmt
,
ssa2
,
e1
,
fa
->
result
);
bprintf
(
ssa
,
"
\v
1.arg%d =
\v
2,
\n
"
,
n
);
e1
=
vcc_expr_edit
(
tl
,
e1
->
fmt
,
ssa
,
e1
,
fa
->
result
);
}
else
if
(
fa
->
result
!=
NULL
)
{
e1
=
vcc_expr_edit
(
tl
,
e1
->
fmt
,
"
\v
1,
\n\v
2"
,
e1
,
fa
->
result
);
...
...
@@ -604,8 +600,7 @@ vcc_func(struct vcc *tl, struct expr **e, const void *priv,
free
(
fa
);
}
if
(
sa
!=
NULL
)
{
bprintf
(
ssa2
,
"
\v
1&%s
\v
-
\n
))"
,
sa
);
*
e
=
vcc_expr_edit
(
tl
,
e1
->
fmt
,
ssa2
,
e1
,
NULL
);
*
e
=
vcc_expr_edit
(
tl
,
e1
->
fmt
,
"
\v
1
\n
})
\v
-"
,
e1
,
NULL
);
}
else
{
*
e
=
vcc_expr_edit
(
tl
,
e1
->
fmt
,
"
\v
1
\n
)
\v
-"
,
e1
,
NULL
);
}
...
...
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