Declare Cyc_utf8_decode as static to improve performance

This commit is contained in:
Justin Ethier 2018-11-26 10:47:02 -05:00
parent 9ccef98305
commit 2b5253d5ca
2 changed files with 4 additions and 3 deletions

View file

@ -766,7 +766,6 @@ void Cyc_set_globals_changed(gc_thread_data *thd);
Cyc_utf8_encode(dest, dest_size, &char_value, 1)
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_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);

View file

@ -21,6 +21,8 @@
//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};
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)
{
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)) {
return obj_char2obj(raw[idx]);
} else {
char_type codepoint;
char_type codepoint = 0;
uint32_t state = 0;
int count;
@ -7250,7 +7252,7 @@ static const uint8_t utf8d[] = {
* @param byte Byte to examine
* @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];
*codep = (*state != CYC_UTF8_ACCEPT) ?