mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
don't (re-)define ascii_isspace and isascii
`ISSPACE` and `ISASCII` can be used instead.
This commit is contained in:
@@ -37,27 +37,6 @@ static char utf8len_codepage_zero[256] =
|
||||
3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,4,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0,
|
||||
};
|
||||
|
||||
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)]
|
||||
|
||||
static mrb_int
|
||||
utf8code(unsigned char* p)
|
||||
{
|
||||
@@ -593,7 +572,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 {
|
||||
@@ -602,7 +581,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, str_subseq(mrb, str, beg, end-beg));
|
||||
mrb_gc_arena_restore(mrb, ai);
|
||||
skip = 1;
|
||||
|
||||
+1
-5
@@ -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;
|
||||
|
||||
|
||||
+2
-23
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user