Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-cluster
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
libvmod-cluster
Commits
cbad0fbe
Commit
cbad0fbe
authored
May 24, 2018
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avoid the evil alloca
parent
7fc2003e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
6 deletions
+10
-6
vmod_cluster.c
src/vmod_cluster.c
+10
-6
No files found.
src/vmod_cluster.c
View file @
cbad0fbe
...
@@ -388,14 +388,15 @@ vmod_cluster_resolve(VRT_CTX, VCL_BACKEND dir)
...
@@ -388,14 +388,15 @@ vmod_cluster_resolve(VRT_CTX, VCL_BACKEND dir)
cluster_task_param_r
(
ctx
,
dir
->
priv
)));
cluster_task_param_r
(
ctx
,
dir
->
priv
)));
}
}
#define be_task_param_l(pl, pr, ctx, vc, arg) do { \
#define be_task_param_l(pl, pr, ctx, vc, arg, spc) \
do { \
if ((pl) != NULL) { \
if ((pl) != NULL) { \
(void)0; \
(void)0; \
} else if ((arg)->resolve == vmod_enum_LAZY) { \
} else if ((arg)->resolve == vmod_enum_LAZY) { \
(pr) = (pl) = cluster_task_param_l( \
(pr) = (pl) = cluster_task_param_l( \
(ctx), (vc), (pr)->nblack + 1); \
(ctx), (vc), (pr)->nblack + 1); \
} else { \
} else { \
(pl) =
alloca(param_sz((pr), (pr)->nblack + 1));
\
(pl) =
(void *)(spc);
\
memcpy((pl), (pr), param_sz((pr), (pr)->nblack)); \
memcpy((pl), (pr), param_sz((pr), (pr)->nblack)); \
(pl)->spcblack = (pr)->nblack + 1; \
(pl)->spcblack = (pr)->nblack + 1; \
(pr) = (pl); \
(pr) = (pl); \
...
@@ -409,7 +410,7 @@ vmod_cluster_backend(VRT_CTX,
...
@@ -409,7 +410,7 @@ vmod_cluster_backend(VRT_CTX,
{
{
int
modify
=
arg
->
valid_deny
||
arg
->
valid_real
||
int
modify
=
arg
->
valid_deny
||
arg
->
valid_real
||
arg
->
valid_uncacheable_direct
;
arg
->
valid_uncacheable_direct
;
const
struct
vmod_cluster_cluster_param
*
pr
=
NULL
;
const
struct
vmod_cluster_cluster_param
*
pr
;
struct
vmod_cluster_cluster_param
*
pl
=
NULL
;
struct
vmod_cluster_cluster_param
*
pl
=
NULL
;
if
(
!
modify
)
{
if
(
!
modify
)
{
...
@@ -426,20 +427,23 @@ vmod_cluster_backend(VRT_CTX,
...
@@ -426,20 +427,23 @@ vmod_cluster_backend(VRT_CTX,
" can not be called here"
);
" can not be called here"
);
return
NULL
;
return
NULL
;
}
}
pr
=
cluster_task_param_r
(
ctx
,
vc
);
pr
=
cluster_task_param_r
(
ctx
,
vc
);
char
pstk
[
param_sz
(
pr
,
pr
->
nblack
+
1
)];
if
(
arg
->
valid_deny
&&
arg
->
deny
!=
NULL
&&
if
(
arg
->
valid_deny
&&
arg
->
deny
!=
NULL
&&
!
cluster_blacklisted
(
pr
,
arg
->
deny
))
{
!
cluster_blacklisted
(
pr
,
arg
->
deny
))
{
be_task_param_l
(
pl
,
pr
,
ctx
,
vc
,
arg
);
be_task_param_l
(
pl
,
pr
,
ctx
,
vc
,
arg
,
pstk
);
cluster_blacklist_add
(
pl
,
arg
->
deny
);
cluster_blacklist_add
(
pl
,
arg
->
deny
);
}
}
if
(
arg
->
valid_real
&&
if
(
arg
->
valid_real
&&
pr
->
real
!=
arg
->
real
)
{
pr
->
real
!=
arg
->
real
)
{
be_task_param_l
(
pl
,
pr
,
ctx
,
vc
,
arg
);
be_task_param_l
(
pl
,
pr
,
ctx
,
vc
,
arg
,
pstk
);
pl
->
real
=
arg
->
real
;
pl
->
real
=
arg
->
real
;
}
}
if
(
arg
->
valid_uncacheable_direct
&&
if
(
arg
->
valid_uncacheable_direct
&&
pr
->
uncacheable_direct
!=
arg
->
valid_uncacheable_direct
)
{
pr
->
uncacheable_direct
!=
arg
->
valid_uncacheable_direct
)
{
be_task_param_l
(
pl
,
pr
,
ctx
,
vc
,
arg
);
be_task_param_l
(
pl
,
pr
,
ctx
,
vc
,
arg
,
pstk
);
pl
->
uncacheable_direct
=
arg
->
valid_uncacheable_direct
;
pl
->
uncacheable_direct
=
arg
->
valid_uncacheable_direct
;
}
}
if
(
arg
->
resolve
==
vmod_enum_LAZY
)
if
(
arg
->
resolve
==
vmod_enum_LAZY
)
...
...
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