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
ddd9f277
Commit
ddd9f277
authored
Jan 11, 2019
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use VSBs to generate code for VMOD objects.
Fixes #2880
parent
7119d790
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
8 deletions
+28
-8
r02880.vtc
bin/varnishtest/tests/r02880.vtc
+13
-0
vcc_vmod.c
lib/libvcc/vcc_vmod.c
+15
-8
No files found.
bin/varnishtest/tests/r02880.vtc
0 → 100644
View file @
ddd9f277
varnishtest "Long VMOD object names"
varnish v1 -vcl {
import debug;
backend b { .host = "${bad_ip}"; }
sub vcl_init {
new l234567890123456789012345678901234567890123456789012345678
= debug.obj();
new l2345678901234567890123456789012345678901234567890123456789
= debug.obj();
}
}
lib/libvcc/vcc_vmod.c
View file @
ddd9f277
...
@@ -38,6 +38,7 @@
...
@@ -38,6 +38,7 @@
#include "vfil.h"
#include "vfil.h"
#include "vjsn.h"
#include "vjsn.h"
#include "vmod_abi.h"
#include "vmod_abi.h"
#include "vsb.h"
static
int
static
int
vcc_path_dlopen
(
void
*
priv
,
const
char
*
fn
)
vcc_path_dlopen
(
void
*
priv
,
const
char
*
fn
)
...
@@ -349,8 +350,7 @@ vcc_Act_New(struct vcc *tl, struct token *t, struct symbol *sym)
...
@@ -349,8 +350,7 @@ vcc_Act_New(struct vcc *tl, struct token *t, struct symbol *sym)
{
{
struct
symbol
*
sy1
,
*
sy2
,
*
sy3
;
struct
symbol
*
sy1
,
*
sy2
,
*
sy3
;
struct
inifin
*
ifp
;
struct
inifin
*
ifp
;
char
buf1
[
128
];
struct
vsb
*
buf
;
char
buf2
[
128
];
const
struct
vjsn_val
*
vv
,
*
vf
;
const
struct
vjsn_val
*
vv
,
*
vf
;
const
char
*
p
;
const
char
*
p
;
...
@@ -393,8 +393,10 @@ vcc_Act_New(struct vcc *tl, struct token *t, struct symbol *sym)
...
@@ -393,8 +393,10 @@ vcc_Act_New(struct vcc *tl, struct token *t, struct symbol *sym)
vf
=
VTAILQ_NEXT
(
vf
,
list
);
vf
=
VTAILQ_NEXT
(
vf
,
list
);
bprintf
(
buf1
,
", &%s,
\"
%s
\"
"
,
sy1
->
rname
,
sy1
->
name
);
buf
=
VSB_new_auto
();
vcc_Eval_Func
(
tl
,
vf
,
buf1
,
sy2
);
VSB_printf
(
buf
,
", &%s,
\"
%s
\"
"
,
sy1
->
rname
,
sy1
->
name
);
VSB_finish
(
buf
);
vcc_Eval_Func
(
tl
,
vf
,
VSB_data
(
buf
),
sy2
);
ERRCHK
(
tl
);
ERRCHK
(
tl
);
SkipToken
(
tl
,
';'
);
SkipToken
(
tl
,
';'
);
sy1
->
def_e
=
tl
->
t
;
sy1
->
def_e
=
tl
->
t
;
...
@@ -411,8 +413,10 @@ vcc_Act_New(struct vcc *tl, struct token *t, struct symbol *sym)
...
@@ -411,8 +413,10 @@ vcc_Act_New(struct vcc *tl, struct token *t, struct symbol *sym)
VSB_printf
(
ifp
->
fin
,
"
\t\t
%s(&%s);"
,
vf
->
value
,
sy1
->
rname
);
VSB_printf
(
ifp
->
fin
,
"
\t\t
%s(&%s);"
,
vf
->
value
,
sy1
->
rname
);
/* Instantiate symbols for the methods */
/* Instantiate symbols for the methods */
bprintf
(
buf1
,
", %s"
,
sy1
->
rname
);
VSB_clear
(
buf
);
p
=
TlDup
(
tl
,
buf1
);
VSB_printf
(
buf
,
", %s"
,
sy1
->
rname
);
VSB_finish
(
buf
);
p
=
TlDup
(
tl
,
VSB_data
(
buf
));
while
(
vv
!=
NULL
)
{
while
(
vv
!=
NULL
)
{
vf
=
VTAILQ_FIRST
(
&
vv
->
children
);
vf
=
VTAILQ_FIRST
(
&
vv
->
children
);
assert
(
vf
->
type
==
VJSN_STRING
);
assert
(
vf
->
type
==
VJSN_STRING
);
...
@@ -420,11 +424,14 @@ vcc_Act_New(struct vcc *tl, struct token *t, struct symbol *sym)
...
@@ -420,11 +424,14 @@ vcc_Act_New(struct vcc *tl, struct token *t, struct symbol *sym)
vf
=
VTAILQ_NEXT
(
vf
,
list
);
vf
=
VTAILQ_NEXT
(
vf
,
list
);
assert
(
vf
->
type
==
VJSN_STRING
);
assert
(
vf
->
type
==
VJSN_STRING
);
bprintf
(
buf2
,
"%s.%s"
,
sy1
->
name
,
vf
->
value
);
VSB_clear
(
buf
);
sy3
=
VCC_MkSym
(
tl
,
buf2
,
SYM_FUNC
,
VCL_LOW
,
VCL_HIGH
);
VSB_printf
(
buf
,
"%s.%s"
,
sy1
->
name
,
vf
->
value
);
VSB_finish
(
buf
);
sy3
=
VCC_MkSym
(
tl
,
VSB_data
(
buf
),
SYM_FUNC
,
VCL_LOW
,
VCL_HIGH
);
AN
(
sy3
);
AN
(
sy3
);
func_sym
(
sy3
,
sy2
->
vmod
,
VTAILQ_NEXT
(
vf
,
list
));
func_sym
(
sy3
,
sy2
->
vmod
,
VTAILQ_NEXT
(
vf
,
list
));
sy3
->
extra
=
p
;
sy3
->
extra
=
p
;
vv
=
VTAILQ_NEXT
(
vv
,
list
);
vv
=
VTAILQ_NEXT
(
vv
,
list
);
}
}
VSB_destroy
(
&
buf
);
}
}
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