summaryrefslogtreecommitdiff
path: root/re.c
diff options
context:
space:
mode:
Diffstat (limited to 're.c')
-rw-r--r--re.c33
1 files changed, 15 insertions, 18 deletions
diff --git a/re.c b/re.c
index 1121615896..4b908ef95d 100644
--- a/re.c
+++ b/re.c
@@ -883,17 +883,28 @@ rb_reg_initialize(obj, s, len, options)
}
}
+static VALUE
+rb_reg_s_alloc(klass)
+ VALUE klass;
+{
+ NEWOBJ(re, struct RRegexp);
+ OBJSETUP(re, klass, T_REGEXP);
+
+ re->ptr = 0;
+ re->len = 0;
+ re->str = 0;
+
+ return (VALUE)re;
+}
+
VALUE
rb_reg_new(s, len, options)
const char *s;
long len;
int options;
{
-
- NEWOBJ(re, struct RRegexp);
- OBJSETUP(re, rb_cRegexp, T_REGEXP);
+ VALUE re = rb_reg_s_alloc(rb_cRegexp);
- re->ptr = 0; re->len = 0; re->str = 0;
rb_reg_initialize(re, s, len, options);
return (VALUE)re;
}
@@ -1042,20 +1053,6 @@ rb_reg_initialize_m(argc, argv, self)
}
static VALUE
-rb_reg_s_alloc(klass)
- VALUE klass;
-{
- NEWOBJ(re, struct RRegexp);
- OBJSETUP(re, klass, T_REGEXP);
-
- re->ptr = 0;
- re->len = 0;
- re->str = 0;
-
- return (VALUE)re;
-}
-
-static VALUE
rb_reg_s_quote(argc, argv)
int argc;
VALUE *argv;