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
9ea6149a
Commit
9ea6149a
authored
May 04, 2015
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a tiny bit of compile time type-safety, just because we can.
parent
f9909907
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
7 deletions
+11
-7
cache_vrt_vmod.c
bin/varnishd/cache/cache_vrt_vmod.c
+7
-4
vrt.h
include/vrt.h
+3
-2
vcc_vmod.c
lib/libvcc/vcc_vmod.c
+1
-1
No files found.
bin/varnishd/cache/cache_vrt_vmod.c
View file @
9ea6149a
...
@@ -62,7 +62,7 @@ struct vmod {
...
@@ -62,7 +62,7 @@ struct vmod {
static
VTAILQ_HEAD
(,
vmod
)
vmods
=
VTAILQ_HEAD_INITIALIZER
(
vmods
);
static
VTAILQ_HEAD
(,
vmod
)
vmods
=
VTAILQ_HEAD_INITIALIZER
(
vmods
);
int
int
VRT_Vmod_Init
(
voi
d
**
hdl
,
void
*
ptr
,
int
len
,
const
char
*
nm
,
VRT_Vmod_Init
(
struct
vmo
d
**
hdl
,
void
*
ptr
,
int
len
,
const
char
*
nm
,
const
char
*
path
,
const
char
*
file_id
,
VRT_CTX
)
const
char
*
path
,
const
char
*
file_id
,
VRT_CTX
)
{
{
struct
vmod
*
v
;
struct
vmod
*
v
;
...
@@ -73,6 +73,8 @@ VRT_Vmod_Init(void **hdl, void *ptr, int len, const char *nm,
...
@@ -73,6 +73,8 @@ VRT_Vmod_Init(void **hdl, void *ptr, int len, const char *nm,
ASSERT_CLI
();
ASSERT_CLI
();
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
AN
(
ctx
->
cli
);
AN
(
ctx
->
cli
);
AN
(
hdl
);
AZ
(
*
hdl
);
dlhdl
=
dlopen
(
path
,
RTLD_NOW
|
RTLD_LOCAL
);
dlhdl
=
dlopen
(
path
,
RTLD_NOW
|
RTLD_LOCAL
);
if
(
dlhdl
==
NULL
)
{
if
(
dlhdl
==
NULL
)
{
...
@@ -141,15 +143,16 @@ VRT_Vmod_Init(void **hdl, void *ptr, int len, const char *nm,
...
@@ -141,15 +143,16 @@ VRT_Vmod_Init(void **hdl, void *ptr, int len, const char *nm,
}
}
void
void
VRT_Vmod_Fini
(
voi
d
**
hdl
)
VRT_Vmod_Fini
(
struct
vmo
d
**
hdl
)
{
{
struct
vmod
*
v
;
struct
vmod
*
v
;
ASSERT_CLI
();
ASSERT_CLI
();
AN
(
*
hdl
);
AN
(
hdl
);
CAST_OBJ_NOTNULL
(
v
,
*
hdl
,
VMOD_MAGIC
)
;
v
=
*
hdl
;
*
hdl
=
NULL
;
*
hdl
=
NULL
;
CHECK_OBJ_NOTNULL
(
v
,
VMOD_MAGIC
);
#ifndef DONT_DLCLOSE_VMODS
#ifndef DONT_DLCLOSE_VMODS
/*
/*
...
...
include/vrt.h
View file @
9ea6149a
...
@@ -58,6 +58,7 @@ struct cli;
...
@@ -58,6 +58,7 @@ struct cli;
struct
director
;
struct
director
;
struct
VCL_conf
;
struct
VCL_conf
;
struct
suckaddr
;
struct
suckaddr
;
struct
vmod
;
/***********************************************************************
/***********************************************************************
* This is the central definition of the mapping from VCL types to
* This is the central definition of the mapping from VCL types to
...
@@ -243,9 +244,9 @@ void VRT_fini_vbe(VRT_CTX, struct director **, const struct vrt_backend *);
...
@@ -243,9 +244,9 @@ void VRT_fini_vbe(VRT_CTX, struct director **, const struct vrt_backend *);
int
VRT_VSA_GetPtr
(
const
struct
suckaddr
*
sua
,
const
unsigned
char
**
dst
);
int
VRT_VSA_GetPtr
(
const
struct
suckaddr
*
sua
,
const
unsigned
char
**
dst
);
/* VMOD/Modules related */
/* VMOD/Modules related */
int
VRT_Vmod_Init
(
voi
d
**
hdl
,
void
*
ptr
,
int
len
,
const
char
*
nm
,
int
VRT_Vmod_Init
(
struct
vmo
d
**
hdl
,
void
*
ptr
,
int
len
,
const
char
*
nm
,
const
char
*
path
,
const
char
*
file_id
,
VRT_CTX
);
const
char
*
path
,
const
char
*
file_id
,
VRT_CTX
);
void
VRT_Vmod_Fini
(
voi
d
**
hdl
);
void
VRT_Vmod_Fini
(
struct
vmo
d
**
hdl
);
struct
vmod_priv
;
struct
vmod_priv
;
typedef
void
vmod_priv_free_f
(
void
*
);
typedef
void
vmod_priv_free_f
(
void
*
);
...
...
lib/libvcc/vcc_vmod.c
View file @
9ea6149a
...
@@ -218,7 +218,7 @@ vcc_ParseImport(struct vcc *tl)
...
@@ -218,7 +218,7 @@ vcc_ParseImport(struct vcc *tl)
}
}
Fh
(
tl
,
0
,
"
\n
/* --- BEGIN VMOD %.*s --- */
\n\n
"
,
PF
(
mod
));
Fh
(
tl
,
0
,
"
\n
/* --- BEGIN VMOD %.*s --- */
\n\n
"
,
PF
(
mod
));
Fh
(
tl
,
0
,
"static
voi
d *VGC_vmod_%.*s;
\n
"
,
PF
(
mod
));
Fh
(
tl
,
0
,
"static
struct vmo
d *VGC_vmod_%.*s;
\n
"
,
PF
(
mod
));
Fh
(
tl
,
0
,
"static struct vmod_priv vmod_priv_%.*s;
\n
"
,
PF
(
mod
));
Fh
(
tl
,
0
,
"static struct vmod_priv vmod_priv_%.*s;
\n
"
,
PF
(
mod
));
Fh
(
tl
,
0
,
"
\n
%s
\n
"
,
vmd
->
proto
);
Fh
(
tl
,
0
,
"
\n
%s
\n
"
,
vmd
->
proto
);
Fh
(
tl
,
0
,
"
\n
/* --- END VMOD %.*s --- */
\n\n
"
,
PF
(
mod
));
Fh
(
tl
,
0
,
"
\n
/* --- END VMOD %.*s --- */
\n\n
"
,
PF
(
mod
));
...
...
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