diff options
| author | cremno <[email protected]> | 2014-06-05 20:27:17 +0200 |
|---|---|---|
| committer | cremno <[email protected]> | 2014-06-05 20:27:17 +0200 |
| commit | f9f864d4dd7f3f4213cabe5f8a4e427a03120461 (patch) | |
| tree | e9c7310e394321b51875000bd569d8f0d20de9b9 /src | |
| parent | 69da21bcb4f022b0bcd2f4b08e6ffcb8ce1ebab7 (diff) | |
| download | mruby-f9f864d4dd7f3f4213cabe5f8a4e427a03120461.tar.gz mruby-f9f864d4dd7f3f4213cabe5f8a4e427a03120461.zip | |
don't (re-)define `ascii_isspace` and `isascii`
`ISSPACE` and `ISASCII` can be used instead.
Diffstat (limited to 'src')
| -rw-r--r-- | src/parse.y | 6 | ||||
| -rw-r--r-- | src/string.c | 25 |
2 files changed, 3 insertions, 28 deletions
diff --git a/src/parse.y b/src/parse.y index 011b77cac..1af6e7833 100644 --- a/src/parse.y +++ b/src/parse.y @@ -42,11 +42,7 @@ static void yywarning(parser_state *p, const char *s); static void backref_error(parser_state *p, node *n); static void tokadd(parser_state *p, int32_t c); -#ifndef isascii -#define isascii(c) (((c) & ~0x7f) == 0) -#endif - -#define identchar(c) (isalnum(c) || (c) == '_' || !isascii(c)) +#define identchar(c) (isalnum(c) || (c) == '_' || !ISASCII(c)) typedef unsigned int stack_type; diff --git a/src/string.c b/src/string.c index 755656f07..842e83d76 100644 --- a/src/string.c +++ b/src/string.c @@ -1728,27 +1728,6 @@ mrb_str_rindex_m(mrb_state *mrb, mrb_value str) return mrb_nil_value(); } -static const char isspacetable[256] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -#define ascii_isspace(c) isspacetable[(unsigned char)(c)] - /* 15.2.10.5.35 */ /* @@ -1844,7 +1823,7 @@ mrb_str_split_m(mrb_state *mrb, mrb_value str) int ai = mrb_gc_arena_save(mrb); c = (unsigned char)*ptr++; if (skip) { - if (ascii_isspace(c)) { + if (ISSPACE(c)) { beg = ptr - bptr; } else { @@ -1853,7 +1832,7 @@ mrb_str_split_m(mrb_state *mrb, mrb_value str) if (lim_p && lim <= i) break; } } - else if (ascii_isspace(c)) { + else if (ISSPACE(c)) { mrb_ary_push(mrb, result, mrb_str_subseq(mrb, str, beg, end-beg)); mrb_gc_arena_restore(mrb, ai); skip = TRUE; |
