mirror of
https://gitlab.freedesktop.org/xorg/lib/libxcb-errors.git
synced 2026-04-19 04:20:38 +02:00
Move extension name into static info
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
322f2e1b81
commit
0ebef8dd7f
3 changed files with 8 additions and 8 deletions
|
|
@ -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__ */
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue