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
4463fbef
Commit
4463fbef
authored
Feb 02, 2016
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish things found by address-sanitizer.
None of it was important or troubling.
parent
cee78231
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
20 deletions
+28
-20
vtc.c
bin/varnishtest/vtc.c
+26
-18
vtc_http.c
bin/varnishtest/vtc_http.c
+2
-2
No files found.
bin/varnishtest/vtc.c
View file @
4463fbef
...
...
@@ -62,6 +62,8 @@ static struct vtclog *vltop;
*/
struct
macro
{
unsigned
magic
;
#define MACRO_MAGIC 0x803423e3
VTAILQ_ENTRY
(
macro
)
list
;
char
*
name
;
char
*
val
;
...
...
@@ -98,18 +100,16 @@ macro_def(struct vtclog *vl, const char *instance, const char *name,
if
(
!
strcmp
(
name
,
m
->
name
))
break
;
if
(
m
==
NULL
)
{
m
=
calloc
(
sizeof
*
m
,
1
);
ALLOC_OBJ
(
m
,
MACRO_MAGIC
);
AN
(
m
);
REPLACE
(
m
->
name
,
name
);
VTAILQ_INSERT_TAIL
(
&
macro_list
,
m
,
list
);
}
AN
(
m
);
va_start
(
ap
,
fmt
);
free
(
m
->
val
);
m
->
val
=
NULL
;
vbprintf
(
buf2
,
fmt
,
ap
);
va_end
(
ap
);
m
->
val
=
strdup
(
buf2
);
REPLACE
(
m
->
val
,
buf2
);
AN
(
m
->
val
);
vtc_log
(
vl
,
4
,
"macro def %s=%s"
,
name
,
m
->
val
);
AZ
(
pthread_mutex_unlock
(
&
macro_mtx
));
...
...
@@ -147,6 +147,7 @@ macro_get(const char *b, const char *e)
int
l
;
char
*
retval
=
NULL
;
l
=
e
-
b
;
if
(
l
==
4
&&
!
memcmp
(
b
,
"date"
,
l
))
{
...
...
@@ -158,9 +159,11 @@ macro_get(const char *b, const char *e)
}
AZ
(
pthread_mutex_lock
(
&
macro_mtx
));
VTAILQ_FOREACH
(
m
,
&
macro_list
,
list
)
if
(
!
memcmp
(
b
,
m
->
name
,
l
)
&&
m
->
name
[
l
]
==
'\0'
)
VTAILQ_FOREACH
(
m
,
&
macro_list
,
list
)
{
CHECK_OBJ_NOTNULL
(
m
,
MACRO_MAGIC
);
if
(
!
strncmp
(
b
,
m
->
name
,
l
)
&&
m
->
name
[
l
]
==
'\0'
)
break
;
}
if
(
m
!=
NULL
)
retval
=
strdup
(
m
->
val
);
AZ
(
pthread_mutex_unlock
(
&
macro_mtx
));
...
...
@@ -207,13 +210,16 @@ macro_expand(struct vtclog *vl, const char *text)
return
(
vsb
);
}
/* extmacro is a list of macro's that are defined from the
command line and are applied to the macro list of each test
instance. No locking is required as they are set before any tests
are started.
*/
/*
* extmacro is a list of macro's that are defined from the
* command line and are applied to the macro list of each test
* instance. No locking is required as they are set before any tests
* are started.
*/
struct
extmacro
{
unsigned
magic
;
#define EXTMACRO_MAGIC 0x51019ded
VTAILQ_ENTRY
(
extmacro
)
list
;
char
*
name
;
char
*
val
;
...
...
@@ -233,24 +239,24 @@ extmacro_def(const char *name, const char *fmt, ...)
if
(
!
strcmp
(
name
,
m
->
name
))
break
;
if
(
m
==
NULL
&&
fmt
!=
NULL
)
{
m
=
calloc
(
sizeof
*
m
,
1
);
ALLOC_OBJ
(
m
,
EXTMACRO_MAGIC
);
AN
(
m
);
REPLACE
(
m
->
name
,
name
);
AN
(
m
->
name
);
VTAILQ_INSERT_TAIL
(
&
extmacro_list
,
m
,
list
);
}
if
(
fmt
!=
NULL
)
{
AN
(
m
);
va_start
(
ap
,
fmt
);
free
(
m
->
val
);
vbprintf
(
buf
,
fmt
,
ap
);
va_end
(
ap
);
m
->
val
=
strdup
(
buf
);
REPLACE
(
m
->
val
,
buf
);
AN
(
m
->
val
);
}
else
if
(
m
!=
NULL
)
{
VTAILQ_REMOVE
(
&
extmacro_list
,
m
,
list
);
free
(
m
->
name
);
free
(
m
->
val
);
free
(
m
);
REPLACE
(
m
->
name
,
NULL
);
REPLACE
(
m
->
val
,
NULL
);
FREE_OBJ
(
m
);
}
}
...
...
@@ -652,8 +658,10 @@ exec_file(const char *fn, const char *script, const char *tmpdir,
init_server
();
/* Apply extmacro definitions */
VTAILQ_FOREACH
(
m
,
&
extmacro_list
,
list
)
VTAILQ_FOREACH
(
m
,
&
extmacro_list
,
list
)
{
CHECK_OBJ_NOTNULL
(
m
,
EXTMACRO_MAGIC
);
macro_def
(
vltop
,
NULL
,
m
->
name
,
"%s"
,
m
->
val
);
}
/*
* We need an IP number which will not repond, ever, and that is a
...
...
bin/varnishtest/vtc_http.c
View file @
4463fbef
...
...
@@ -223,10 +223,10 @@ cmd_var_resolve(struct http *hp, char *spec)
return
(
hp
->
bodylen
);
if
(
!
strcmp
(
spec
,
"resp.body"
))
return
(
hp
->
body
!=
NULL
?
hp
->
body
:
spec
);
if
(
!
mem
cmp
(
spec
,
"req.http."
,
9
))
{
if
(
!
strn
cmp
(
spec
,
"req.http."
,
9
))
{
hh
=
hp
->
req
;
hdr
=
spec
+
9
;
}
else
if
(
!
mem
cmp
(
spec
,
"resp.http."
,
10
))
{
}
else
if
(
!
strn
cmp
(
spec
,
"resp.http."
,
10
))
{
hh
=
hp
->
resp
;
hdr
=
spec
+
10
;
}
else
...
...
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