summaryrefslogtreecommitdiffhomepage
path: root/src/dump.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2015-05-17 20:42:41 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2015-05-17 20:42:41 +0900
commitcf070b64f16d95dcd058a3a9c368cc1a31d2e14a (patch)
tree6953f684bc7ca30db63c06f838f7a5347c30f56c /src/dump.c
parent0cae5eaf9423a44589436dc6135f803728629224 (diff)
parent406fb9c80922e2355d0034b2fe9d9baecb61f41f (diff)
downloadmruby-cf070b64f16d95dcd058a3a9c368cc1a31d2e14a.tar.gz
mruby-cf070b64f16d95dcd058a3a9c368cc1a31d2e14a.zip
Merge pull request #2792 from cremno/let-the-c-compiler-validate-the-identifier
let the C compiler validate the identifier
Diffstat (limited to 'src/dump.c')
-rw-r--r--src/dump.c18
1 files changed, 1 insertions, 17 deletions
diff --git a/src/dump.c b/src/dump.c
index 285aa08d9..1ab4c47c5 100644
--- a/src/dump.c
+++ b/src/dump.c
@@ -1020,22 +1020,6 @@ mrb_dump_irep_binary(mrb_state *mrb, mrb_irep *irep, uint8_t flags, FILE* fp)
}
static mrb_bool
-is_valid_c_symbol_name(const char *name)
-{
- const char *c = NULL;
-
- if (name == NULL || name[0] == '\0') return FALSE;
- if (!ISALPHA(name[0]) && name[0] != '_') return FALSE;
-
- c = &name[1];
- for (; *c != '\0'; ++c) {
- if (!ISALNUM(*c) && *c != '_') return FALSE;
- }
-
- return TRUE;
-}
-
-static mrb_bool
dump_bigendian_p(uint8_t flags)
{
switch (flags & DUMP_ENDIAN_NAT) {
@@ -1056,7 +1040,7 @@ mrb_dump_irep_cfunc(mrb_state *mrb, mrb_irep *irep, uint8_t flags, FILE *fp, con
size_t bin_size = 0, bin_idx = 0;
int result;
- if (fp == NULL || initname == NULL || !is_valid_c_symbol_name(initname)) {
+ if (fp == NULL || initname == NULL || initname[0] == '\0') {
return MRB_DUMP_INVALID_ARGUMENT;
}
flags = dump_flags(flags, FLAG_BYTEORDER_NATIVE);