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
9b64ca3d
Commit
9b64ca3d
authored
Aug 22, 2018
by
Poul-Henning Kamp
Committed by
Dridi Boukelmoune
Oct 16, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Align handling of STRINGS derived types.
Fixes: #2745 Conflicts: bin/varnishtest/tests/v00020.vtc
parent
3c3e37a2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
14 deletions
+23
-14
vcc_compile.h
lib/libvcc/vcc_compile.h
+1
-0
vcc_expr.c
lib/libvcc/vcc_expr.c
+19
-14
vcc_types.c
lib/libvcc/vcc_types.c
+3
-0
No files found.
lib/libvcc/vcc_compile.h
View file @
9b64ca3d
...
@@ -103,6 +103,7 @@ struct type {
...
@@ -103,6 +103,7 @@ struct type {
const
char
*
name
;
const
char
*
name
;
const
char
*
tostring
;
const
char
*
tostring
;
vcc_type_t
multype
;
vcc_type_t
multype
;
int
stringform
;
};
};
#define VCC_TYPE(foo) extern const struct type foo[1];
#define VCC_TYPE(foo) extern const struct type foo[1];
...
...
lib/libvcc/vcc_expr.c
View file @
9b64ca3d
...
@@ -73,7 +73,7 @@ vcc_islit(const struct expr *e)
...
@@ -73,7 +73,7 @@ vcc_islit(const struct expr *e)
static
const
char
*
static
const
char
*
vcc_utype
(
vcc_type_t
t
)
vcc_utype
(
vcc_type_t
t
)
{
{
if
(
t
==
STRINGS
||
t
==
STRING_LIST
)
if
(
t
==
STRINGS
||
t
->
stringform
)
t
=
STRING
;
t
=
STRING
;
return
(
t
->
name
);
return
(
t
->
name
);
}
}
...
@@ -278,7 +278,7 @@ vcc_expr_tostring(struct vcc *tl, struct expr **e, vcc_type_t fmt)
...
@@ -278,7 +278,7 @@ vcc_expr_tostring(struct vcc *tl, struct expr **e, vcc_type_t fmt)
uint8_t
constant
=
EXPR_VAR
;
uint8_t
constant
=
EXPR_VAR
;
CHECK_OBJ_NOTNULL
(
*
e
,
EXPR_MAGIC
);
CHECK_OBJ_NOTNULL
(
*
e
,
EXPR_MAGIC
);
assert
(
fmt
==
STRINGS
||
fmt
==
STRING_LIST
||
fmt
==
STRING
);
assert
(
fmt
==
STRINGS
||
fmt
->
stringform
);
assert
(
fmt
!=
(
*
e
)
->
fmt
);
assert
(
fmt
!=
(
*
e
)
->
fmt
);
p
=
(
*
e
)
->
fmt
->
tostring
;
p
=
(
*
e
)
->
fmt
->
tostring
;
...
@@ -361,6 +361,7 @@ vcc_Eval_Handle(struct vcc *tl, struct expr **e, struct token *t,
...
@@ -361,6 +361,7 @@ vcc_Eval_Handle(struct vcc *tl, struct expr **e, struct token *t,
(
void
)
t
;
(
void
)
t
;
(
void
)
tl
;
(
void
)
tl
;
AN
(
sym
->
rname
);
AN
(
sym
->
rname
);
AZ
(
type
->
stringform
);
if
(
sym
->
type
!=
STRING
&&
type
==
STRINGS
)
{
if
(
sym
->
type
!=
STRING
&&
type
==
STRINGS
)
{
*
e
=
vcc_mk_expr
(
STRINGS
,
"
\"
%s
\"
"
,
sym
->
name
);
*
e
=
vcc_mk_expr
(
STRINGS
,
"
\"
%s
\"
"
,
sym
->
name
);
...
@@ -1274,22 +1275,26 @@ vcc_expr0(struct vcc *tl, struct expr **e, vcc_type_t fmt)
...
@@ -1274,22 +1275,26 @@ vcc_expr0(struct vcc *tl, struct expr **e, vcc_type_t fmt)
assert
(
fmt
!=
STRINGS
);
assert
(
fmt
!=
STRINGS
);
*
e
=
NULL
;
*
e
=
NULL
;
t1
=
tl
->
t
;
t1
=
tl
->
t
;
if
(
fmt
==
STRING_LIST
||
fmt
==
STRING
)
if
(
fmt
->
stringform
)
vcc_expr_cor
(
tl
,
e
,
STRINGS
);
vcc_expr_cor
(
tl
,
e
,
STRINGS
);
else
else
vcc_expr_cor
(
tl
,
e
,
fmt
);
vcc_expr_cor
(
tl
,
e
,
fmt
);
ERRCHK
(
tl
);
ERRCHK
(
tl
);
assert
((
*
e
)
->
fmt
!=
STRING_LIST
&&
(
*
e
)
->
fmt
!=
STRING
);
assert
(
!
(
*
e
)
->
fmt
->
stringform
);
if
((
*
e
)
->
fmt
==
STRINGS
&&
fmt
==
STRING_LIST
)
if
((
*
e
)
->
fmt
!=
STRINGS
&&
fmt
->
stringform
)
(
*
e
)
->
fmt
=
STRING_LIST
;
vcc_expr_tostring
(
tl
,
e
,
STRINGS
);
else
if
((
*
e
)
->
fmt
==
STRINGS
&&
fmt
==
STRING
)
*
e
=
vcc_expr_edit
(
tl
,
STRING
,
"
\v
S"
,
*
e
,
NULL
);
if
((
*
e
)
->
fmt
==
STRINGS
&&
fmt
->
stringform
)
{
else
if
((
*
e
)
->
fmt
==
STRINGS
&&
fmt
==
STRANDS
)
{
if
(
fmt
==
STRING_LIST
)
*
e
=
vcc_expr_edit
(
tl
,
STRANDS
,
"
\v
T"
,
(
*
e
),
NULL
);
(
*
e
)
->
fmt
=
STRING_LIST
;
}
else
if
((
*
e
)
->
fmt
!=
STRINGS
&&
else
if
(
fmt
==
STRING
)
(
fmt
==
STRING
||
fmt
==
STRING_LIST
))
*
e
=
vcc_expr_edit
(
tl
,
STRING
,
"
\v
S"
,
*
e
,
NULL
);
vcc_expr_tostring
(
tl
,
e
,
fmt
);
else
if
(
fmt
==
STRANDS
)
*
e
=
vcc_expr_edit
(
tl
,
STRANDS
,
"
\v
T"
,
(
*
e
),
NULL
);
else
WRONG
(
"Unhandled stringform"
);
}
if
((
*
e
)
->
fmt
==
STRING_LIST
)
if
((
*
e
)
->
fmt
==
STRING_LIST
)
*
e
=
vcc_expr_edit
(
tl
,
STRING_LIST
,
*
e
=
vcc_expr_edit
(
tl
,
STRING_LIST
,
...
...
lib/libvcc/vcc_types.c
View file @
9b64ca3d
...
@@ -131,11 +131,13 @@ const struct type STEVEDORE[1] = {{
...
@@ -131,11 +131,13 @@ const struct type STEVEDORE[1] = {{
const
struct
type
STRING
[
1
]
=
{{
const
struct
type
STRING
[
1
]
=
{{
.
magic
=
TYPE_MAGIC
,
.
magic
=
TYPE_MAGIC
,
.
name
=
"STRING"
,
.
name
=
"STRING"
,
.
stringform
=
1
,
}};
}};
const
struct
type
STRANDS
[
1
]
=
{{
const
struct
type
STRANDS
[
1
]
=
{{
.
magic
=
TYPE_MAGIC
,
.
magic
=
TYPE_MAGIC
,
.
name
=
"STRANDS"
,
.
name
=
"STRANDS"
,
.
stringform
=
1
,
}};
}};
const
struct
type
STRINGS
[
1
]
=
{{
const
struct
type
STRINGS
[
1
]
=
{{
...
@@ -147,6 +149,7 @@ const struct type STRINGS[1] = {{
...
@@ -147,6 +149,7 @@ const struct type STRINGS[1] = {{
const
struct
type
STRING_LIST
[
1
]
=
{{
const
struct
type
STRING_LIST
[
1
]
=
{{
.
magic
=
TYPE_MAGIC
,
.
magic
=
TYPE_MAGIC
,
.
name
=
"STRING_LIST"
,
.
name
=
"STRING_LIST"
,
.
stringform
=
1
,
}};
}};
const
struct
type
SUB
[
1
]
=
{{
const
struct
type
SUB
[
1
]
=
{{
...
...
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