summaryrefslogtreecommitdiff
path: root/symbol.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-05-26 16:51:49 (GMT)
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-05-26 16:51:49 (GMT)
commit1623f4e77ea72e522415f4bde8d7a2bc49c315e1 (patch)
treec269f533765adc776469c1b77a8835c493539e5e /symbol.c
parent3deb1c57c60d54884ccb9d59a8d21b74e0d412f6 (diff)
* symbol.c (is_identchar): use ISDIGIT instead of rb_enc_isalnum.
Though rb_enc_isalnum is encoding aware function, its argument here is *m, which is a single byte. Therefore ISDIGIT is faster. * symbol.c (is_special_global_name): ditto. * symbol.c (rb_enc_symname_type): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55178 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'symbol.c')
-rw-r--r--symbol.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/symbol.c b/symbol.c
index b37be2f..facdb3c 100644
--- a/symbol.c
+++ b/symbol.c
@@ -28,7 +28,7 @@ static ID register_static_symid_str(ID, VALUE);
#define REGISTER_SYMID(id, name) register_static_symid((id), (name), strlen(name), enc)
#include "id.c"
-#define is_identchar(p,e,enc) (rb_enc_isalnum((unsigned char)(*(p)),(enc)) || (*(p)) == '_' || !ISASCII(*(p)))
+#define is_identchar(p,e,enc) (ISALNUM((unsigned char)*(p)) || (*(p)) == '_' || !ISASCII(*(p)))
#define op_tbl_count numberof(op_tbl)
STATIC_ASSERT(op_tbl_name_size, sizeof(op_tbl[0].name) == 3);
@@ -177,11 +177,11 @@ is_special_global_name(const char *m, const char *e, rb_encoding *enc)
}
}
else {
- if (!rb_enc_isdigit(*m, enc)) return 0;
+ if (!ISDIGIT(*m)) return 0;
do {
if (!ISASCII(*m)) mb = 1;
++m;
- } while (m < e && rb_enc_isdigit(*m, enc));
+ } while (m < e && ISDIGIT(*m));
}
return m == e ? mb + 1 : 0;
}
@@ -278,9 +278,9 @@ rb_enc_symname_type(const char *name, long len, rb_encoding *enc, unsigned int a
break;
default:
- type = rb_enc_isupper(*m, enc) ? ID_CONST : ID_LOCAL;
+ type = ISUPPER(*m) ? ID_CONST : ID_LOCAL;
id:
- if (m >= e || (*m != '_' && !rb_enc_isalpha(*m, enc) && ISASCII(*m))) {
+ if (m >= e || (*m != '_' && !ISALPHA(*m) && ISASCII(*m))) {
if (len > 1 && *(e-1) == '=') {
type = rb_enc_symname_type(name, len-1, enc, allowed_attrset);
if (type != ID_ATTRSET) return ID_ATTRSET;