[ruby/yarp] make some encoding tables const
https://github.com/ruby/yarp/commit/777c376deb
This commit is contained in:
parent
f644996f2e
commit
e50fcca9a7
@ -60,7 +60,7 @@ size_t yp_encoding_utf_8_alnum_char(const uint8_t *b, ptrdiff_t n);
|
|||||||
|
|
||||||
// This lookup table is referenced in both the UTF-8 encoding file and the
|
// This lookup table is referenced in both the UTF-8 encoding file and the
|
||||||
// parser directly in order to speed up the default encoding processing.
|
// parser directly in order to speed up the default encoding processing.
|
||||||
extern uint8_t yp_encoding_unicode_table[256];
|
extern const uint8_t yp_encoding_unicode_table[256];
|
||||||
|
|
||||||
// These are the encodings that are supported by the parser. They are defined in
|
// These are the encodings that are supported by the parser. They are defined in
|
||||||
// their own files in the src/enc directory.
|
// their own files in the src/enc directory.
|
||||||
|
@ -10,7 +10,7 @@ typedef uint32_t yp_unicode_codepoint_t;
|
|||||||
// this table is different from other encodings where we used a lookup table
|
// this table is different from other encodings where we used a lookup table
|
||||||
// because the indices of those tables are the byte representations, not the
|
// because the indices of those tables are the byte representations, not the
|
||||||
// codepoints themselves.
|
// codepoints themselves.
|
||||||
uint8_t yp_encoding_unicode_table[256] = {
|
const uint8_t yp_encoding_unicode_table[256] = {
|
||||||
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
|
// 0 1 2 3 4 5 6 7 8 9 A B C D E F
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
|
||||||
@ -31,7 +31,7 @@ uint8_t yp_encoding_unicode_table[256] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define UNICODE_ALPHA_CODEPOINTS_LENGTH 1450
|
#define UNICODE_ALPHA_CODEPOINTS_LENGTH 1450
|
||||||
static yp_unicode_codepoint_t unicode_alpha_codepoints[UNICODE_ALPHA_CODEPOINTS_LENGTH] = {
|
static const yp_unicode_codepoint_t unicode_alpha_codepoints[UNICODE_ALPHA_CODEPOINTS_LENGTH] = {
|
||||||
0x100, 0x2C1,
|
0x100, 0x2C1,
|
||||||
0x2C6, 0x2D1,
|
0x2C6, 0x2D1,
|
||||||
0x2E0, 0x2E4,
|
0x2E0, 0x2E4,
|
||||||
@ -760,7 +760,7 @@ static yp_unicode_codepoint_t unicode_alpha_codepoints[UNICODE_ALPHA_CODEPOINTS_
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define UNICODE_ALNUM_CODEPOINTS_LENGTH 1528
|
#define UNICODE_ALNUM_CODEPOINTS_LENGTH 1528
|
||||||
static yp_unicode_codepoint_t unicode_alnum_codepoints[UNICODE_ALNUM_CODEPOINTS_LENGTH] = {
|
static const yp_unicode_codepoint_t unicode_alnum_codepoints[UNICODE_ALNUM_CODEPOINTS_LENGTH] = {
|
||||||
0x100, 0x2C1,
|
0x100, 0x2C1,
|
||||||
0x2C6, 0x2D1,
|
0x2C6, 0x2D1,
|
||||||
0x2E0, 0x2E4,
|
0x2E0, 0x2E4,
|
||||||
@ -1528,7 +1528,7 @@ static yp_unicode_codepoint_t unicode_alnum_codepoints[UNICODE_ALNUM_CODEPOINTS_
|
|||||||
};
|
};
|
||||||
|
|
||||||
#define UNICODE_ISUPPER_CODEPOINTS_LENGTH 1296
|
#define UNICODE_ISUPPER_CODEPOINTS_LENGTH 1296
|
||||||
static yp_unicode_codepoint_t unicode_isupper_codepoints[UNICODE_ISUPPER_CODEPOINTS_LENGTH] = {
|
static const yp_unicode_codepoint_t unicode_isupper_codepoints[UNICODE_ISUPPER_CODEPOINTS_LENGTH] = {
|
||||||
0x100, 0x100,
|
0x100, 0x100,
|
||||||
0x102, 0x102,
|
0x102, 0x102,
|
||||||
0x104, 0x104,
|
0x104, 0x104,
|
||||||
@ -2180,7 +2180,7 @@ static yp_unicode_codepoint_t unicode_isupper_codepoints[UNICODE_ISUPPER_CODEPOI
|
|||||||
};
|
};
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
yp_unicode_codepoint_match(yp_unicode_codepoint_t codepoint, yp_unicode_codepoint_t *codepoints, size_t size) {
|
yp_unicode_codepoint_match(yp_unicode_codepoint_t codepoint, const yp_unicode_codepoint_t *codepoints, size_t size) {
|
||||||
size_t start = 0;
|
size_t start = 0;
|
||||||
size_t end = size;
|
size_t end = size;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user