aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/buildcommands.py
diff options
context:
space:
mode:
authorKevin O'Connor <kevin@koconnor.net>2017-06-15 14:01:42 -0400
committerKevin O'Connor <kevin@koconnor.net>2017-06-29 13:33:58 -0400
commit1ae78d08e9a7d356c4b8555799ee42c9244c1b7d (patch)
tree22362290b90b5091be8a6ca9a6c5e50422e22b23 /scripts/buildcommands.py
parent1c3cbe9456aa97d7956283ef2f852f6c0489ab1f (diff)
downloadkutter-1ae78d08e9a7d356c4b8555799ee42c9244c1b7d.tar.gz
kutter-1ae78d08e9a7d356c4b8555799ee42c9244c1b7d.tar.xz
kutter-1ae78d08e9a7d356c4b8555799ee42c9244c1b7d.zip
command: Encode MESSAGE_MIN in command_parser->max_size
Add the message minimum into the stored constant so it does not need to be added at run-time. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Diffstat (limited to 'scripts/buildcommands.py')
-rw-r--r--scripts/buildcommands.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/scripts/buildcommands.py b/scripts/buildcommands.py
index 8e220bad..a26801ee 100644
--- a/scripts/buildcommands.py
+++ b/scripts/buildcommands.py
@@ -30,7 +30,8 @@ def error(msg):
def build_parser(parser, iscmd, all_param_types):
if parser.name == "#empty":
- return "\n // Empty message\n .max_size=0,"
+ return "\n // Empty message\n .max_size=%d," % (
+ msgproto.MESSAGE_MIN,)
if parser.name == "#output":
comment = "Output: " + parser.msgformat
else:
@@ -54,8 +55,9 @@ def build_parser(parser, iscmd, all_param_types):
+ types.count('PT_buffer'))
out += " .num_args=%d," % (num_args,)
else:
- max_size = min(msgproto.MESSAGE_MAX - msgproto.MESSAGE_MIN
- , 1 + sum([t.max_length for t in parser.param_types]))
+ max_size = min(msgproto.MESSAGE_MAX,
+ (msgproto.MESSAGE_MIN + 1
+ + sum([t.max_length for t in parser.param_types])))
out += " .max_size=%d," % (max_size,)
return out