diff options
author | Uli Schlachter <psychon@znc.in> | 2015-04-04 16:49:58 +0200 |
---|---|---|
committer | Uli Schlachter <psychon@znc.in> | 2015-04-04 16:49:58 +0200 |
commit | 0ebef8dd7f12e7520c1003a0197313ae7dd7c1ac (patch) | |
tree | 428355ac957f7968ddcc75bd0377fb4f6802d289 /src | |
parent | 322f2e1b8132e4f1013581793280a91c7b376282 (diff) |
Move extension name into static info
Signed-off-by: Uli Schlachter <psychon@znc.in>
Diffstat (limited to 'src')
-rw-r--r-- | src/errors.h | 3 | ||||
-rwxr-xr-x | src/extensions.py | 3 | ||||
-rw-r--r-- | src/xcb_errors.c | 10 |
3 files changed, 8 insertions, 8 deletions
diff --git a/src/errors.h b/src/errors.h index 5bf3f3f..8065c78 100644 --- a/src/errors.h +++ b/src/errors.h @@ -35,13 +35,14 @@ struct static_extension_info_t { const char *strings_minor; const char *strings_events; const char *strings_errors; + const char *name; }; extern const struct static_extension_info_t xproto_info; int register_extensions(xcb_errors_context_t *ctx, xcb_connection_t *conn); int register_extension(xcb_errors_context_t *ctx, xcb_connection_t *conn, - xcb_query_extension_cookie_t cookie, const char *name, + xcb_query_extension_cookie_t cookie, const struct static_extension_info_t static_info); #endif /* __ERRORS_H__ */ diff --git a/src/extensions.py b/src/extensions.py index 06f4710..a3aa2c3 100755 --- a/src/extensions.py +++ b/src/extensions.py @@ -105,6 +105,7 @@ def emit_module(module): format_strings("minor", module.requests_table) format_strings("events", module.events_table) format_strings("errors", module.errors_table) + output.write("\t.name = \"%s\",\n" % module.name) output.write("};\n\n") for module in modules: @@ -118,7 +119,7 @@ output.write("\tint ret = 0;\n"); for idx in range(len(modules)): output.write("\tcookies[%d] = xcb_query_extension(conn, strlen(\"%s\"), \"%s\");\n" % (idx, modules[idx].xname, modules[idx].xname)); for idx in range(len(modules)): - output.write("\tret |= register_extension(ctx, conn, cookies[%d], \"%s\", extension_%s_info);\n" % (idx, modules[idx].name, modules[idx].name)); + output.write("\tret |= register_extension(ctx, conn, cookies[%d], extension_%s_info);\n" % (idx, modules[idx].name)); output.write("\treturn ret;\n"); output.write("}\n"); diff --git a/src/xcb_errors.c b/src/xcb_errors.c index 0c6c742..8fdf182 100644 --- a/src/xcb_errors.c +++ b/src/xcb_errors.c @@ -34,7 +34,6 @@ struct extension_info_t { uint8_t major_opcode; uint8_t first_event; uint8_t first_error; - const char *name; }; struct xcb_errors_context_t { @@ -48,7 +47,7 @@ static const char *get_strings_entry(const char *strings, unsigned int index) { } int register_extension(xcb_errors_context_t *ctx, xcb_connection_t *conn, - xcb_query_extension_cookie_t cookie, const char *name, + xcb_query_extension_cookie_t cookie, const struct static_extension_info_t static_info) { struct extension_info_t *info; @@ -66,7 +65,6 @@ int register_extension(xcb_errors_context_t *ctx, xcb_connection_t *conn, return -1; } - info->name = name; info->static_info = static_info; info->major_opcode = reply->major_opcode; info->first_event = reply->first_event; @@ -128,7 +126,7 @@ const char *xcb_errors_get_name_for_major_code(xcb_errors_context_t *ctx, if (info == NULL) return get_strings_entry(xproto_info.strings_minor, major_code); - return info->name; + return info->static_info.name; } const char *xcb_errors_get_name_for_minor_code(xcb_errors_context_t *ctx, @@ -175,7 +173,7 @@ const char *xcb_errors_get_name_for_event(xcb_errors_context_t *ctx, } if (extension) - *extension = best->name; + *extension = best->static_info.name; return get_strings_entry(best->static_info.strings_events, event_code - best->first_event); } @@ -208,6 +206,6 @@ const char *xcb_errors_get_name_for_error(xcb_errors_context_t *ctx, } if (extension) - *extension = best->name; + *extension = best->static_info.name; return get_strings_entry(best->static_info.strings_errors, error_code - best->first_error); } |