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
64407985
Commit
64407985
authored
Feb 15, 2017
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Introduce WS_ReserveLumps() to allocate an array of something.
parent
4e0004ea
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
10 deletions
+19
-10
cache.h
bin/varnishd/cache/cache.h
+1
-0
cache_ws.c
bin/varnishd/cache/cache_ws.c
+10
-0
cache_http1_line.c
bin/varnishd/http1/cache_http1_line.c
+4
-5
vmod_std_querysort.c
lib/libvmod_std/vmod_std_querysort.c
+4
-5
No files found.
bin/varnishd/cache/cache.h
View file @
64407985
...
...
@@ -1058,6 +1058,7 @@ void WRK_BgThread(pthread_t *thr, const char *name, bgthread_t *func,
void
WS_Init
(
struct
ws
*
ws
,
const
char
*
id
,
void
*
space
,
unsigned
len
);
unsigned
WS_Reserve
(
struct
ws
*
ws
,
unsigned
bytes
);
unsigned
WS_ReserveLumps
(
struct
ws
*
ws
,
size_t
sz
);
void
WS_MarkOverflow
(
struct
ws
*
ws
);
void
WS_Release
(
struct
ws
*
ws
,
unsigned
bytes
);
void
WS_ReleaseP
(
struct
ws
*
ws
,
char
*
ptr
);
...
...
bin/varnishd/cache/cache_ws.c
View file @
64407985
...
...
@@ -241,6 +241,16 @@ WS_Reserve(struct ws *ws, unsigned bytes)
return
(
pdiff
(
ws
->
f
,
ws
->
r
));
}
unsigned
WS_ReserveLumps
(
struct
ws
*
ws
,
size_t
sz
)
{
unsigned
u
;
u
=
WS_Reserve
(
ws
,
0
);
u
/=
sz
;
return
(
u
);
}
void
WS_Release
(
struct
ws
*
ws
,
unsigned
bytes
)
{
...
...
bin/varnishd/http1/cache_http1_line.c
View file @
64407985
...
...
@@ -88,16 +88,15 @@ V1L_Reserve(struct worker *wrk, struct ws *ws, int *fd, struct vsl_log *vsl,
v1l
->
ws
=
ws
;
v1l
->
res
=
res
;
u
=
WS_Reserve
(
ws
,
0
);
u
=
PRNDDN
(
u
);
u
/=
sizeof
(
struct
iovec
);
u
=
WS_ReserveLumps
(
ws
,
sizeof
(
struct
iovec
));
if
(
u
==
0
)
{
WS_Release
(
ws
,
0
);
WS_MarkOverflow
(
ws
);
return
;
}
else
if
(
u
>
IOV_MAX
)
}
if
(
u
>
IOV_MAX
)
u
=
IOV_MAX
;
v1l
->
iov
=
(
void
*
)
PRNDUP
(
ws
->
f
)
;
v1l
->
iov
=
(
void
*
)
ws
->
f
;
v1l
->
siov
=
u
;
v1l
->
ciov
=
u
;
v1l
->
werr
=
0
;
...
...
lib/libvmod_std/vmod_std_querysort.c
View file @
64407985
...
...
@@ -56,6 +56,7 @@ vmod_querysort(VRT_CTX, VCL_STRING url)
char
*
p
,
*
r
;
const
char
**
pp
;
const
char
**
pe
;
unsigned
u
;
int
np
;
int
i
;
...
...
@@ -78,16 +79,14 @@ vmod_querysort(VRT_CTX, VCL_STRING url)
if
(
r
==
NULL
)
return
(
url
);
(
void
)
WS_Reserve
(
ctx
->
ws
,
0
);
/* We trust cache_ws.c to align sensibly */
u
=
WS_ReserveLumps
(
ctx
->
ws
,
sizeof
(
const
char
**
));
pp
=
(
const
char
**
)(
void
*
)(
ctx
->
ws
->
f
);
pe
=
(
const
char
**
)(
void
*
)(
ctx
->
ws
->
e
);
if
(
pp
+
4
>
pe
)
{
if
(
u
<
4
)
{
WS_Release
(
ctx
->
ws
,
0
);
WS_MarkOverflow
(
ctx
->
ws
);
return
(
url
);
}
pe
=
pp
+
u
;
/* Collect params as pointer pairs */
np
=
0
;
...
...
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