summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2013-02-19 09:12:03 -0800
committerYukihiro "Matz" Matsumoto <[email protected]>2013-02-19 09:12:03 -0800
commiteed875ac79db48acfb1b49292bc51e3b44e6a93f (patch)
tree038718022727db89d7542e6c6ab0d9c3bc8fd112
parentad84829b6ace1a9dd8a9016a3e38b0cb56fd6507 (diff)
parent2942ad8eeb10291caaa83852d1b426a06ed84d20 (diff)
downloadmruby-eed875ac79db48acfb1b49292bc51e3b44e6a93f.tar.gz
mruby-eed875ac79db48acfb1b49292bc51e3b44e6a93f.zip
Merge pull request #853 from cremno/pluggable-regex-msvc-fix
MSVC: vars must be declared at the start of a block
-rw-r--r--src/codegen.c8
-rw-r--r--src/parse.y6
2 files changed, 7 insertions, 7 deletions
diff --git a/src/codegen.c b/src/codegen.c
index 86cb5eb87..8cb571a28 100644
--- a/src/codegen.c
+++ b/src/codegen.c
@@ -1918,12 +1918,12 @@ codegen(codegen_scope *s, node *tree, int val)
int ai = mrb_gc_arena_save(s->mrb);
struct RClass* c = mrb_class_get(s->mrb, REGEXP_CLASS);
mrb_value args[2];
+ int off;
+
args[0] = mrb_str_new(s->mrb, p1, strlen(p1));
// TODO: Some regexp implementation does not have second argument
- //args[1] = mrb_str_new(s->mrb, p2, strlen(p2));
- int off = new_lit(s,
- mrb_class_new_instance(s->mrb, 1, args, c));
-
+ //args[1] = mrb_str_new(s->mrb, p2, strlen(p2))
+ off = new_lit(s, mrb_class_new_instance(s->mrb, 1, args, c));
mrb_gc_arena_restore(s->mrb, ai);
genop(s, MKOP_ABx(OP_LOADL, cursp(), off));
push();
diff --git a/src/parse.y b/src/parse.y
index 9af8682c1..4355c2222 100644
--- a/src/parse.y
+++ b/src/parse.y
@@ -3447,8 +3447,9 @@ parse_string(parser_state *p, int term)
if (p->regexp) {
int f = 0;
int c;
- char* s;
- s = strndup(tok(p), toklen(p));
+ char *s = strndup(tok(p), toklen(p));
+ char flag[4] = { '\0' };
+
newtok(p);
while (c = nextc(p), ISALPHA(c)) {
switch (c) {
@@ -3467,7 +3468,6 @@ parse_string(parser_state *p, int term)
toklen(p) > 1 ? "s" : "", tok(p));
yyerror(p, msg);
}
- char flag[4] = {0};
if (f & 1) strcat(flag, "i");
if (f & 2) strcat(flag, "x");
if (f & 4) strcat(flag, "m");