From af0fecc120033e12412385b6ad0b1c85d5363270 Mon Sep 17 00:00:00 2001 From: Franciszek Stachura Date: Thu, 6 Jun 2024 11:25:42 +0200 Subject: [PATCH 1/2] Remove net from keyword blacklist --- lib.py | 1 - 1 file changed, 1 deletion(-) diff --git a/lib.py b/lib.py index 3aa245e6..7d112582 100755 --- a/lib.py +++ b/lib.py @@ -124,7 +124,6 @@ def decode(byte_object): b'msg', b'n', b'name', - b'net', b'next', b'offset', b'ops', From 719b55f77f9f6413450bbab5c9d6abd72f85a3f7 Mon Sep 17 00:00:00 2001 From: Franciszek Stachura Date: Mon, 8 Jul 2024 14:30:04 +0200 Subject: [PATCH 2/2] Remove most identifiers from blacklist Leave only identifiers related to macros, control flow and type declarations. Change blacklist into a set. --- lib.py | 131 ++++++++++++++------------------------------------------- 1 file changed, 32 insertions(+), 99 deletions(-) diff --git a/lib.py b/lib.py index 7d112582..4bb29398 100755 --- a/lib.py +++ b/lib.py @@ -64,109 +64,42 @@ def decode(byte_object): # Typically for very frequent variable names and things redefined by #define # TODO: allow to have per project blacklists -blacklist = ( - b'NULL', - b'__', - b'adapter', - b'addr', - b'arg', - b'attr', - b'base', - b'bp', - b'buf', - b'buffer', - b'c', - b'card', - b'char', - b'chip', - b'cmd', - b'codec', - b'const', - b'count', - b'cpu', - b'ctx', - b'data', +blacklist = set([ + b'enum', + b'struct', + b'union', + + b'if', + b'else', + + b'return', + + b'switch', + b'case', b'default', + + b'for', + b'while', + b'do', + b'break', + b'continue', + b'goto', + + b'true', + b'false', + b'NULL', + b'define', - b'desc', - b'dev', - b'driver', + b'elif', b'else', - b'end', b'endif', - b'entry', - b'err', - b'error', - b'event', - b'extern', - b'failed', - b'flags', - b'h', - b'host', - b'hw', - b'i', - b'id', - b'idx', - b'if', - b'index', - b'info', - b'inline', - b'int', - b'irq', - b'j', - b'len', - b'length', - b'list', - b'lock', - b'long', - b'mask', - b'mode', - b'msg', - b'n', - b'name', - b'next', - b'offset', - b'ops', - b'out', - b'p', - b'pdev', - b'port', - b'priv', - b'ptr', - b'q', - b'r', - b'rc', - b'rdev', - b'reg', - b'regs', - b'req', - b'res', - b'result', - b'ret', - b'return', - b'retval', - b'root', - b's', - b'sb', - b'size', - b'sizeof', - b'sk', - b'skb', - b'spec', - b'start', - b'state', - b'static', - b'status', - b'struct', - b't', - b'tmp', - b'tp', - b'type', - b'val', - b'value', - b'vcpu', - b'x' -) + b'ifdef', + b'ifndef', + b'elifdef', + b'elifndef', + b'undef', + b'__', +]) def isIdent(bstr): if (len(bstr) < 2 or