Commit 5f846923 authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto

Merge pull request #2095 from suzukaze/refactor-dump.c

Use boolean macro in is_valid_c_symbol_name()
parents 73c86f59 81308c0b
...@@ -831,20 +831,20 @@ mrb_dump_irep_binary(mrb_state *mrb, mrb_irep *irep, int debug_info, FILE* fp) ...@@ -831,20 +831,20 @@ mrb_dump_irep_binary(mrb_state *mrb, mrb_irep *irep, int debug_info, FILE* fp)
return result; return result;
} }
static int static mrb_bool
is_valid_c_symbol_name(const char *name) is_valid_c_symbol_name(const char *name)
{ {
const char *c = NULL; const char *c = NULL;
if (name == NULL || name[0] == '\0') return 0; if (name == NULL || name[0] == '\0') return FALSE;
if (!ISALPHA(name[0]) && name[0] != '_') return 0; if (!ISALPHA(name[0]) && name[0] != '_') return FALSE;
c = &name[1]; c = &name[1];
for (; *c != '\0'; ++c) { for (; *c != '\0'; ++c) {
if (!ISALNUM(*c) && *c != '_') return 0; if (!ISALNUM(*c) && *c != '_') return FALSE;
} }
return 1; return TRUE;
} }
int int
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment