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
9b1f1d17
Commit
9b1f1d17
authored
Jun 02, 2021
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix PeekToken(): Should never be called with EOI token, and thus cannot return NULL.
parent
0a4884c6
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
17 deletions
+14
-17
vcc_acl.c
lib/libvcc/vcc_acl.c
+2
-2
vcc_compile.h
lib/libvcc/vcc_compile.h
+3
-3
vcc_token.c
lib/libvcc/vcc_token.c
+9
-12
No files found.
lib/libvcc/vcc_acl.c
View file @
9b1f1d17
...
@@ -457,7 +457,7 @@ vcc_acl_entry(struct vcc *tl)
...
@@ -457,7 +457,7 @@ vcc_acl_entry(struct vcc *tl)
*/
*/
static
void
static
void
vcc_acl_emit_tokens
(
struct
vcc
*
tl
,
const
struct
acl_e
*
ae
)
vcc_acl_emit_tokens
(
const
struct
vcc
*
tl
,
const
struct
acl_e
*
ae
)
{
{
struct
token
*
t
;
struct
token
*
t
;
const
char
*
sep
=
""
;
const
char
*
sep
=
""
;
...
@@ -490,7 +490,7 @@ vcc_acl_emit_tokens(struct vcc *tl, const struct acl_e *ae)
...
@@ -490,7 +490,7 @@ vcc_acl_emit_tokens(struct vcc *tl, const struct acl_e *ae)
*/
*/
static
unsigned
static
unsigned
vcc_acl_emit_tables
(
struct
vcc
*
tl
,
unsigned
n
,
const
char
*
name
)
vcc_acl_emit_tables
(
const
struct
vcc
*
tl
,
unsigned
n
,
const
char
*
name
)
{
{
struct
acl_e
*
ae
;
struct
acl_e
*
ae
;
unsigned
rv
=
sizeof
(
ae
->
data
)
+
3
;
unsigned
rv
=
sizeof
(
ae
->
data
)
+
3
;
...
...
lib/libvcc/vcc_compile.h
View file @
9b1f1d17
...
@@ -415,13 +415,13 @@ void vcc_Warn(struct vcc *);
...
@@ -415,13 +415,13 @@ void vcc_Warn(struct vcc *);
void
vcc__Expect
(
struct
vcc
*
tl
,
unsigned
tok
,
unsigned
line
);
void
vcc__Expect
(
struct
vcc
*
tl
,
unsigned
tok
,
unsigned
line
);
int
vcc_IdIs
(
const
struct
token
*
t
,
const
char
*
p
);
int
vcc_IdIs
(
const
struct
token
*
t
,
const
char
*
p
);
void
vcc_PrintTokens
(
struct
vcc
*
tl
,
const
struct
token
*
tb
,
void
vcc_PrintTokens
(
const
struct
vcc
*
tl
,
const
struct
token
*
tb
,
const
struct
token
*
te
);
const
struct
token
*
te
);
void
vcc_ExpectVid
(
struct
vcc
*
tl
,
const
char
*
what
);
void
vcc_ExpectVid
(
struct
vcc
*
tl
,
const
char
*
what
);
void
vcc_Lexer
(
struct
vcc
*
tl
,
struct
source
*
sp
);
void
vcc_Lexer
(
struct
vcc
*
tl
,
struct
source
*
sp
);
void
vcc_NextToken
(
struct
vcc
*
tl
);
void
vcc_NextToken
(
struct
vcc
*
tl
);
struct
token
*
vcc_PeekToken
(
struct
vcc
*
tl
);
struct
token
*
vcc_PeekToken
(
const
struct
vcc
*
tl
);
struct
token
*
vcc_PeekTokenFrom
(
struct
vcc
*
tl
,
const
struct
token
*
t
);
struct
token
*
vcc_PeekTokenFrom
(
const
struct
vcc
*
tl
,
const
struct
token
*
t
);
void
vcc__ErrInternal
(
struct
vcc
*
tl
,
const
char
*
func
,
void
vcc__ErrInternal
(
struct
vcc
*
tl
,
const
char
*
func
,
unsigned
line
);
unsigned
line
);
...
...
lib/libvcc/vcc_token.c
View file @
9b1f1d17
...
@@ -264,24 +264,20 @@ vcc_ErrWhere(struct vcc *tl, const struct token *t)
...
@@ -264,24 +264,20 @@ vcc_ErrWhere(struct vcc *tl, const struct token *t)
/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------*/
struct
token
*
struct
token
*
vcc_PeekTokenFrom
(
struct
vcc
*
tl
,
const
struct
token
*
t
)
vcc_PeekTokenFrom
(
const
struct
vcc
*
tl
,
const
struct
token
*
t
)
{
{
struct
token
*
t
n
;
struct
token
*
t
2
;
CHECK_OBJ_NOTNULL
(
tl
,
VCC_MAGIC
);
CHECK_OBJ_NOTNULL
(
tl
,
VCC_MAGIC
);
AN
(
t
);
AN
(
t
);
tn
=
VTAILQ_NEXT
(
t
,
list
);
assert
(
t
->
tok
!=
EOI
);
if
(
tn
==
NULL
)
{
t2
=
VTAILQ_NEXT
(
t
,
list
);
VSB_cat
(
tl
->
sb
,
AN
(
t2
);
"Ran out of input, something is missing or"
return
(
t2
);
" maybe unbalanced (...) or {...}
\n
"
);
tl
->
err
=
1
;
}
return
(
tn
);
}
}
struct
token
*
struct
token
*
vcc_PeekToken
(
struct
vcc
*
tl
)
vcc_PeekToken
(
const
struct
vcc
*
tl
)
{
{
CHECK_OBJ_NOTNULL
(
tl
,
VCC_MAGIC
);
CHECK_OBJ_NOTNULL
(
tl
,
VCC_MAGIC
);
...
@@ -330,7 +326,8 @@ vcc_IdIs(const struct token *t, const char *p)
...
@@ -330,7 +326,8 @@ vcc_IdIs(const struct token *t, const char *p)
*/
*/
void
void
vcc_PrintTokens
(
struct
vcc
*
tl
,
const
struct
token
*
tb
,
const
struct
token
*
te
)
vcc_PrintTokens
(
const
struct
vcc
*
tl
,
const
struct
token
*
tb
,
const
struct
token
*
te
)
{
{
CHECK_OBJ_NOTNULL
(
tl
,
VCC_MAGIC
);
CHECK_OBJ_NOTNULL
(
tl
,
VCC_MAGIC
);
...
...
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