mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-25 04:55:04 +02:00
Declare Cyc_utf8_decode as static to improve performance
This commit is contained in:
parent
9ccef98305
commit
2b5253d5ca
2 changed files with 4 additions and 3 deletions
|
@ -766,7 +766,6 @@ void Cyc_set_globals_changed(gc_thread_data *thd);
|
||||||
Cyc_utf8_encode(dest, dest_size, &char_value, 1)
|
Cyc_utf8_encode(dest, dest_size, &char_value, 1)
|
||||||
|
|
||||||
int Cyc_utf8_encode(char *dest, int sz, uint32_t *src, int srcsz);
|
int Cyc_utf8_encode(char *dest, int sz, uint32_t *src, int srcsz);
|
||||||
uint32_t Cyc_utf8_decode(uint32_t* state, uint32_t* codep, uint32_t byte);
|
|
||||||
int Cyc_utf8_count_code_points(uint8_t* s);
|
int Cyc_utf8_count_code_points(uint8_t* s);
|
||||||
int Cyc_utf8_count_code_points_and_bytes(uint8_t* s, char_type *codepoint, int *cpts, int *bytes);
|
int Cyc_utf8_count_code_points_and_bytes(uint8_t* s, char_type *codepoint, int *cpts, int *bytes);
|
||||||
uint32_t Cyc_utf8_validate_stream(uint32_t *state, char *str, size_t len);
|
uint32_t Cyc_utf8_validate_stream(uint32_t *state, char *str, size_t len);
|
||||||
|
|
|
@ -21,6 +21,8 @@
|
||||||
//int JAE_DEBUG = 0;
|
//int JAE_DEBUG = 0;
|
||||||
//int gcMoveCountsDEBUG[20] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
|
//int gcMoveCountsDEBUG[20] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
|
||||||
|
|
||||||
|
static uint32_t Cyc_utf8_decode(uint32_t* state, uint32_t* codep, uint32_t byte);
|
||||||
|
|
||||||
object Cyc_global_set(void *thd, object * glo, object value)
|
object Cyc_global_set(void *thd, object * glo, object value)
|
||||||
{
|
{
|
||||||
gc_mut_update((gc_thread_data *) thd, *glo, value);
|
gc_mut_update((gc_thread_data *) thd, *glo, value);
|
||||||
|
@ -2367,7 +2369,7 @@ object Cyc_string_ref(void *data, object str, object k)
|
||||||
if (string_num_cp(str) == string_len(str)) {
|
if (string_num_cp(str) == string_len(str)) {
|
||||||
return obj_char2obj(raw[idx]);
|
return obj_char2obj(raw[idx]);
|
||||||
} else {
|
} else {
|
||||||
char_type codepoint;
|
char_type codepoint = 0;
|
||||||
uint32_t state = 0;
|
uint32_t state = 0;
|
||||||
int count;
|
int count;
|
||||||
|
|
||||||
|
@ -7250,7 +7252,7 @@ static const uint8_t utf8d[] = {
|
||||||
* @param byte Byte to examine
|
* @param byte Byte to examine
|
||||||
* @return The current state: `CYC_UTF8_ACCEPT` if successful otherwise `CYC_UTF8_REJECT`.
|
* @return The current state: `CYC_UTF8_ACCEPT` if successful otherwise `CYC_UTF8_REJECT`.
|
||||||
*/
|
*/
|
||||||
uint32_t Cyc_utf8_decode(uint32_t* state, uint32_t* codep, uint32_t byte) {
|
static uint32_t Cyc_utf8_decode(uint32_t* state, uint32_t* codep, uint32_t byte) {
|
||||||
uint32_t type = utf8d[byte];
|
uint32_t type = utf8d[byte];
|
||||||
|
|
||||||
*codep = (*state != CYC_UTF8_ACCEPT) ?
|
*codep = (*state != CYC_UTF8_ACCEPT) ?
|
||||||
|
|
Loading…
Add table
Reference in a new issue