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
5922eb75
Commit
5922eb75
authored
Sep 03, 2012
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a WS_Copy() function and use it a couple of places.
parent
adbff322
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
16 deletions
+31
-16
cache.h
bin/varnishd/cache/cache.h
+1
-0
cache_http.c
bin/varnishd/cache/cache_http.c
+1
-2
cache_req_fsm.c
bin/varnishd/cache/cache_req_fsm.c
+2
-2
cache_ws.c
bin/varnishd/cache/cache_ws.c
+27
-12
No files found.
bin/varnishd/cache/cache.h
View file @
5922eb75
...
...
@@ -1034,6 +1034,7 @@ void WS_ReleaseP(struct ws *ws, char *ptr);
void
WS_Assert
(
const
struct
ws
*
ws
);
void
WS_Reset
(
struct
ws
*
ws
,
char
*
p
);
char
*
WS_Alloc
(
struct
ws
*
ws
,
unsigned
bytes
);
char
*
WS_Copy
(
struct
ws
*
ws
,
const
char
*
str
,
int
len
);
char
*
WS_Snapshot
(
struct
ws
*
ws
);
/* rfc2616.c */
...
...
bin/varnishd/cache/cache_http.c
View file @
5922eb75
...
...
@@ -888,10 +888,9 @@ http_CopyHome(const struct http *hp)
continue
;
}
l
=
Tlen
(
hp
->
hd
[
u
]);
p
=
WS_
Alloc
(
hp
->
ws
,
l
+
1
);
p
=
WS_
Copy
(
hp
->
ws
,
hp
->
hd
[
u
].
b
,
l
+
1L
);
if
(
p
!=
NULL
)
{
http_VSLH
(
hp
,
u
);
memcpy
(
p
,
hp
->
hd
[
u
].
b
,
l
+
1L
);
hp
->
hd
[
u
].
b
=
p
;
hp
->
hd
[
u
].
e
=
p
+
l
;
}
else
{
...
...
bin/varnishd/cache/cache_req_fsm.c
View file @
5922eb75
...
...
@@ -617,9 +617,9 @@ cnt_fetchbody(struct worker *wrk, struct req *req)
req
->
obj
->
gziped
=
1
;
if
(
vary
!=
NULL
)
{
req
->
obj
->
vary
=
(
void
*
)
WS_Alloc
(
req
->
obj
->
http
->
ws
,
varyl
);
req
->
obj
->
vary
=
(
void
*
)
WS_Copy
(
req
->
obj
->
http
->
ws
,
VSB_data
(
vary
),
varyl
);
AN
(
req
->
obj
->
vary
);
memcpy
(
req
->
obj
->
vary
,
VSB_data
(
vary
),
varyl
);
VRY_Validate
(
req
->
obj
->
vary
);
VSB_delete
(
vary
);
}
...
...
bin/varnishd/cache/cache_ws.c
View file @
5922eb75
...
...
@@ -116,6 +116,33 @@ WS_Alloc(struct ws *ws, unsigned bytes)
return
(
r
);
}
char
*
WS_Copy
(
struct
ws
*
ws
,
const
char
*
str
,
int
len
)
{
char
*
r
;
unsigned
bytes
;
WS_Assert
(
ws
);
assert
(
ws
->
r
==
NULL
);
if
(
len
==
-
1
)
len
=
strlen
(
str
)
+
1
;
assert
(
len
>=
0
);
bytes
=
PRNDUP
((
unsigned
)
len
);
if
(
ws
->
f
+
bytes
>
ws
->
e
)
{
ws
->
overflow
++
;
WS_Assert
(
ws
);
return
(
NULL
);
}
r
=
ws
->
f
;
ws
->
f
+=
bytes
;
memcpy
(
r
,
str
,
len
);
DSL
(
DBG_WORKSPACE
,
0
,
"WS_Copy(%p, %d) = %p"
,
ws
,
len
,
r
);
WS_Assert
(
ws
);
return
(
r
);
}
char
*
WS_Snapshot
(
struct
ws
*
ws
)
{
...
...
@@ -174,15 +201,3 @@ WS_ReleaseP(struct ws *ws, char *ptr)
ws
->
r
=
NULL
;
WS_Assert
(
ws
);
}
#if 0
/* XXX: not used anywhere (yet) */
void
WS_Return(struct ws *ws, char *s, char *e)
{
WS_Assert(ws);
if (e == ws->f)
ws->f = s;
}
#endif
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