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
9a64ba93
Commit
9a64ba93
authored
Dec 21, 2017
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vmodtool: enforce function and argument names be valid c symbols
parent
fb5779c6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
4 deletions
+12
-4
vmodtool.py
lib/libvcc/vmodtool.py
+12
-4
No files found.
lib/libvcc/vmodtool.py
View file @
9a64ba93
...
...
@@ -310,6 +310,8 @@ def arg(txt):
return
a
,
s
def
nmlegal
(
nm
):
return
re
.
match
(
'^[a-zA-Z0-9_]+$'
,
nm
)
# XXX cant have ( or ) in an argument default value
class
prototype
(
object
):
...
...
@@ -332,6 +334,8 @@ class prototype(object):
i
=
s
.
find
(
"("
)
assert
i
>
0
self
.
name
=
prefix
+
s
[:
i
]
.
strip
()
if
not
nmlegal
(
self
.
cname
()):
err
(
"
%
s(): Illegal name
\n
"
%
self
.
name
,
warn
=
False
)
s
=
s
[
i
:]
.
strip
()
assert
s
[
0
]
==
"("
assert
s
[
-
1
]
==
")"
...
...
@@ -340,9 +344,13 @@ class prototype(object):
names
=
{}
while
len
(
s
)
>
0
:
a
,
s
=
arg
(
s
)
if
a
.
nm
is
not
None
and
a
.
nm
in
names
:
err
(
"
%
s(): duplicate argument name '
%
s'
\n
"
%
(
self
.
name
,
a
.
nm
),
warn
=
False
)
if
a
.
nm
is
not
None
:
if
not
nmlegal
(
a
.
nm
):
err
(
"
%
s(): illegal argument name '
%
s'
\n
"
%
(
self
.
name
,
a
.
nm
),
warn
=
False
)
if
a
.
nm
in
names
:
err
(
"
%
s(): duplicate argument name '
%
s'
\n
"
%
(
self
.
name
,
a
.
nm
),
warn
=
False
)
names
[
a
.
nm
]
=
True
self
.
args
.
append
(
a
)
s
=
s
.
lstrip
()
...
...
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