diff options
| author | Andrey Konovalov <andreyknvl@gmail.com> | 2016-10-11 20:12:15 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-10-11 20:12:15 +0200 |
| commit | cb8fcaf84c7386b129ef54d9ee5fd36b6c56bf0d (patch) | |
| tree | 5ce14a1f0391e34fb97fd317e47ff9a799ccf79e /sysparser | |
| parent | 0c1a91b184c3cb0ae4d5d7927ad51c5cde958b22 (diff) | |
| parent | 2392578fe9881369b980a20fd6f169471b50a565 (diff) | |
Merge pull request #81 from xairy/better-len
Refactor & improve len type handling
Diffstat (limited to 'sysparser')
| -rw-r--r-- | sysparser/lexer.go | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/sysparser/lexer.go b/sysparser/lexer.go index 85f657d41..06210a584 100644 --- a/sysparser/lexer.go +++ b/sysparser/lexer.go @@ -90,13 +90,13 @@ func Parse(in io.Reader) *Description { if len(str.Flds) <= 1 { failf("union %v has only %v fields, need at least 2", str.Name, len(str.Flds)) } - fields := make(map[string]bool) - for _, f := range str.Flds { - if fields[f[0]] { - failf("duplicate filed %v in struct/union %v", f[0], str.Name) - } - fields[f[0]] = true + } + fields := make(map[string]bool) + for _, f := range str.Flds { + if fields[f[0]] { + failf("duplicate field %v in struct/union %v", f[0], str.Name) } + fields[f[0]] = true } structs[str.Name] = *str str = nil @@ -178,6 +178,13 @@ func Parse(in io.Reader) *Description { if idx := strings.IndexByte(callName, '$'); idx != -1 { callName = callName[:idx] } + fields := make(map[string]bool) + for _, a := range args { + if fields[a[0]] { + failf("duplicate arg %v in syscall %v", a[0], name) + } + fields[a[0]] = true + } syscalls = append(syscalls, Syscall{name, callName, args, ret}) case '=': // flag |
