mirror of
https://gitlab.freedesktop.org/xorg/lib/libxcb-errors.git
synced 2026-05-05 15:48:03 +02:00
Define the "unknown foo" lists as strings
This gets rid of lots of relocations that were needed for the pointers into the strings. Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
514070caf8
commit
925ab1e7fb
3 changed files with 12 additions and 12 deletions
|
|
@ -35,9 +35,9 @@ struct static_extension_info_t {
|
|||
const char *strings_errors;
|
||||
};
|
||||
|
||||
extern const char *unknown_major_code[256];
|
||||
extern const char *unknown_error_code[256];
|
||||
extern const char *unknown_event_code[256];
|
||||
extern const char unknown_major_code[];
|
||||
extern const char unknown_error_code[];
|
||||
extern const char unknown_event_code[];
|
||||
|
||||
const char *xproto_get_name_for_major_code(uint8_t major_code);
|
||||
const char *xproto_get_name_for_event(uint8_t event_code);
|
||||
|
|
|
|||
|
|
@ -26,20 +26,20 @@
|
|||
#include "xcb_errors.h"
|
||||
#include "errors.h"
|
||||
|
||||
const char *unknown_major_code[256] = {
|
||||
#define ENTRY(i) "Unknown major code " #i,
|
||||
const char unknown_major_code[] = {
|
||||
#define ENTRY(i) "Unknown major code " #i "\0"
|
||||
#include "static_tables.inc"
|
||||
#undef ENTRY
|
||||
};
|
||||
|
||||
const char *unknown_error_code[256] = {
|
||||
#define ENTRY(i) "Unknown error " #i,
|
||||
const char unknown_error_code[] = {
|
||||
#define ENTRY(i) "Unknown error " #i "\0"
|
||||
#include "static_tables.inc"
|
||||
#undef ENTRY
|
||||
};
|
||||
|
||||
const char *unknown_event_code[256] = {
|
||||
#define ENTRY(i) "Unknown event " #i,
|
||||
const char unknown_event_code[] = {
|
||||
#define ENTRY(i) "Unknown event " #i "\0"
|
||||
#include "static_tables.inc"
|
||||
#undef ENTRY
|
||||
};
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ const char *xcb_errors_get_name_for_major_code(xcb_errors_context_t *ctx,
|
|||
info = info->next;
|
||||
|
||||
if (info == NULL)
|
||||
return unknown_major_code[major_code];
|
||||
return get_strings_entry(unknown_major_code, major_code);
|
||||
|
||||
return info->name;
|
||||
}
|
||||
|
|
@ -184,7 +184,7 @@ const char *xcb_errors_get_name_for_event(xcb_errors_context_t *ctx,
|
|||
info = info->next;
|
||||
|
||||
if (info == NULL)
|
||||
return unknown_event_code[event_code];
|
||||
return get_strings_entry(unknown_event_code, event_code);
|
||||
|
||||
return get_strings_entry(info->static_info.strings_events, event_code - info->first_event);
|
||||
}
|
||||
|
|
@ -201,7 +201,7 @@ const char *xcb_errors_get_name_for_error(xcb_errors_context_t *ctx,
|
|||
info = info->next;
|
||||
|
||||
if (info == NULL)
|
||||
return unknown_error_code[error_code];
|
||||
return get_strings_entry(unknown_error_code, error_code);
|
||||
|
||||
return get_strings_entry(info->static_info.strings_errors, error_code - info->first_error);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue