diff options
author | Uli Schlachter <psychon@znc.in> | 2015-03-24 21:22:18 +0100 |
---|---|---|
committer | Uli Schlachter <psychon@znc.in> | 2015-03-24 21:23:35 +0100 |
commit | 8f230431a678970d9d8fd0f5fc859e73e612a3ca (patch) | |
tree | e1c07be9d7028292dc26725565e3f90c38b39943 /src | |
parent | 278a19c56676ef24a57020f2b3d78c44ee9faaf9 (diff) |
static_extension_info_t: Use uint8_t again were possible
The previous commit changed these fields into uint16_t since xproto tries to
assign value 256 here. However, this isn't actually necessary, so this commit
reverts that and instead makes the code generator emit a 0 here, since this
value isn't used anyway.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Diffstat (limited to 'src')
-rw-r--r-- | src/errors.h | 4 | ||||
-rwxr-xr-x | src/extensions.py | 7 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/errors.h b/src/errors.h index f854bcb..5bf3f3f 100644 --- a/src/errors.h +++ b/src/errors.h @@ -30,8 +30,8 @@ struct static_extension_info_t { uint16_t num_minor; - uint16_t num_events; - uint16_t num_errors; + uint8_t num_events; + uint8_t num_errors; const char *strings_minor; const char *strings_events; const char *strings_errors; diff --git a/src/extensions.py b/src/extensions.py index 39e4c1a..ec400ed 100755 --- a/src/extensions.py +++ b/src/extensions.py @@ -80,7 +80,12 @@ def format_strings(name, table): output.write("\t.num_%s = 0,\n" % name) output.write("\t.strings_%s = NULL,\n" % name) else: - output.write("\t.num_%s = %d,\n" % (name, len(table))) + if len(table) == 256: + # This must be xproto and the value isn't used, so instead use + # something that fits into uint8_t. + output.write("\t.num_%s = 0,\n" % (name)) + else: + output.write("\t.num_%s = %d,\n" % (name, len(table))) output.write("\t.strings_%s = \"%s\\0\",\n" % (name, "\\0".join(table))) def emit_module(module): |