ext/dtext/dtext.c in dtext_rb-1.0.7 vs ext/dtext/dtext.c in dtext_rb-1.0.8
- old
+ new
@@ -494,10 +494,11 @@
g_free(sm);
}
static VALUE parse(int argc, VALUE * argv, VALUE self) {
VALUE input;
+ VALUE input0;
VALUE options;
VALUE opt_inline;
VALUE opt_strip;
VALUE ret;
rb_encoding * encoding = NULL;
@@ -508,14 +509,15 @@
if (argc == 0) {
rb_raise(rb_eArgError, "wrong number of arguments (0 for 1)");
}
input = argv[0];
+ input0 = rb_str_dup(input);
sm = (StateMachine *)g_malloc0(sizeof(StateMachine));
- input = rb_str_cat(input, "\0", 1);
- init_machine(sm, input);
+ input0 = rb_str_cat(input0, "\0", 1);
+ init_machine(sm, input0);
if (argc > 1) {
options = argv[1];
if (!NIL_P(options)) {
@@ -530,22 +532,22 @@
}
}
}
-#line 536 "ext/dtext/dtext.c"
+#line 538 "ext/dtext/dtext.c"
{
sm->cs = dtext_start;
( sm->top) = 0;
( sm->ts) = 0;
( sm->te) = 0;
( sm->act) = 0;
}
-#line 1333 "ext/dtext/dtext.rl"
+#line 1335 "ext/dtext/dtext.rl"
-#line 547 "ext/dtext/dtext.c"
+#line 549 "ext/dtext/dtext.c"
{
if ( ( sm->p) == ( sm->pe) )
goto _test_eof;
if ( sm->cs == 0 )
goto _out;
@@ -553,11 +555,11 @@
switch ( _dtext_from_state_actions[ sm->cs] ) {
case 58:
#line 1 "NONE"
{( sm->ts) = ( sm->p);}
break;
-#line 559 "ext/dtext/dtext.c"
+#line 561 "ext/dtext/dtext.c"
}
switch ( sm->cs ) {
case 256:
switch( (*( sm->p)) ) {
@@ -4084,11 +4086,11 @@
switch ( _dtext_to_state_actions[ sm->cs] ) {
case 57:
#line 1 "NONE"
{( sm->ts) = 0;}
break;
-#line 4090 "ext/dtext/dtext.c"
+#line 4092 "ext/dtext/dtext.c"
}
if ( sm->cs == 0 )
goto _out;
if ( ++( sm->p) != ( sm->pe) )
@@ -4403,10 +4405,10 @@
}
_out: {}
}
-#line 1334 "ext/dtext/dtext.rl"
+#line 1336 "ext/dtext/dtext.rl"
dstack_close(sm);
encoding = rb_enc_find("utf-8");
ret = rb_enc_str_new(sm->output->str, sm->output->len, encoding);