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
5dc88013
Commit
5dc88013
authored
Sep 06, 2021
by
Dridi Boukelmoune
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
miniobj: Add a FINI_OBJ() macro
It operates on a pointer like FREE_OBJ() and clears it.
parent
f8974400
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
17 additions
and
9 deletions
+17
-9
cache_session.c
bin/varnishd/cache/cache_session.c
+1
-2
vhp_table.c
bin/varnishd/hpack/vhp_table.c
+3
-3
cache_http2_hpack.c
bin/varnishd/http2/cache_http2_hpack.c
+1
-1
storage_simple.c
bin/varnishd/storage/storage_simple.c
+5
-2
miniobj.h
include/miniobj.h
+6
-0
vev.c
lib/libvarnish/vev.c
+1
-1
No files found.
bin/varnishd/cache/cache_session.c
View file @
5dc88013
...
...
@@ -425,8 +425,7 @@ ses_handle(struct waited *wp, enum wait_event ev, vtim_real now)
CAST_OBJ_NOTNULL
(
xp
,
(
const
void
*
)
wp
->
priv2
,
TRANSPORT_MAGIC
);
AN
(
wp
->
priv2
);
assert
(
WS_Reservation
(
sp
->
ws
)
==
wp
);
wp
->
magic
=
0
;
wp
=
NULL
;
FINI_OBJ
(
wp
);
/* The WS was reserved in SES_Wait() */
WS_Release
(
sp
->
ws
,
0
);
...
...
bin/varnishd/hpack/vhp_table.c
View file @
5dc88013
...
...
@@ -122,7 +122,7 @@ vht_trim(struct vht_table *tbl, ssize_t max)
assert
(
e
->
offset
==
u
);
u
+=
ENTRYLEN
(
e
);
v
++
;
e
->
magic
=
0
;
FINI_OBJ
(
e
)
;
}
else
{
/* Fixup offset */
assert
(
e
->
offset
>=
u
);
...
...
@@ -257,7 +257,7 @@ VHT_NewEntry_Indexed(struct vht_table *tbl, unsigned idx)
assert
(
e
->
offset
==
0
);
lname
=
e
->
namelen
;
lentry
=
ENTRYLEN
(
e
);
e
->
magic
=
0
;
FINI_OBJ
(
e
)
;
memmove
(
TBLENTRY
(
tbl
,
1
),
TBLENTRY
(
tbl
,
0
),
(
tbl
->
n
-
1
)
*
sizeof
*
e
);
tbl
->
n
--
;
...
...
@@ -462,7 +462,7 @@ VHT_Init(struct vht_table *tbl, size_t protomax)
INIT_OBJ
(
tbl
,
VHT_TABLE_MAGIC
);
r
=
VHT_SetProtoMax
(
tbl
,
protomax
);
if
(
r
)
{
tbl
->
magic
=
0
;
FINI_OBJ
(
tbl
)
;
return
(
r
);
}
tbl
->
maxsize
=
tbl
->
protomax
;
...
...
bin/varnishd/http2/cache_http2_hpack.c
View file @
5dc88013
...
...
@@ -216,7 +216,7 @@ h2h_decode_fini(const struct h2_sess *h2)
ret
=
H2CE_COMPRESSION_ERROR
;
}
else
ret
=
d
->
error
;
d
->
magic
=
0
;
FINI_OBJ
(
d
)
;
return
(
ret
);
}
...
...
bin/varnishd/storage/storage_simple.c
View file @
5dc88013
...
...
@@ -252,18 +252,21 @@ sml_slim(struct worker *wrk, struct objcore *oc)
static
void
v_matchproto_
(
objfree_f
)
sml_objfree
(
struct
worker
*
wrk
,
struct
objcore
*
oc
)
{
struct
storage
*
st
;
struct
object
*
o
;
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
CHECK_OBJ_NOTNULL
(
oc
,
OBJCORE_MAGIC
);
sml_slim
(
wrk
,
oc
);
CAST_OBJ_NOTNULL
(
o
,
oc
->
stobj
->
priv
,
OBJECT_MAGIC
);
o
->
magic
=
0
;
st
=
o
->
objstore
;
CHECK_OBJ_NOTNULL
(
st
,
STORAGE_MAGIC
);
FINI_OBJ
(
o
);
if
(
oc
->
boc
==
NULL
&&
oc
->
stobj
->
stevedore
->
lru
!=
NULL
)
LRU_Remove
(
oc
);
sml_stv_free
(
oc
->
stobj
->
stevedore
,
o
->
objstore
);
sml_stv_free
(
oc
->
stobj
->
stevedore
,
st
);
memset
(
oc
->
stobj
,
0
,
sizeof
oc
->
stobj
);
...
...
include/miniobj.h
View file @
5dc88013
...
...
@@ -17,6 +17,12 @@
(to)->magic = (type_magic); \
} while (0)
#define FINI_OBJ(to) \
do { \
ZERO_OBJ(&(to)->magic, sizeof (to)->magic); \
to = NULL; \
} while (0)
#define ALLOC_OBJ(to, type_magic) \
do { \
(to) = calloc(1, sizeof *(to)); \
...
...
lib/libvarnish/vev.c
View file @
5dc88013
...
...
@@ -337,8 +337,8 @@ VEV_Stop(struct vev_root *evb, struct vev *e)
es
->
happened
=
0
;
}
e
->
magic
=
0
;
e
->
__vevb
=
NULL
;
FINI_OBJ
(
e
);
}
/*--------------------------------------------------------------------*/
...
...
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