Commit d958aa2c authored by Tatsuhiko Kubo's avatar Tatsuhiko Kubo

Unify duplicated functions (noregexp() and regexp_check()).

parent c457aa21
...@@ -107,6 +107,9 @@ mrb_int mrb_str_hash(mrb_state *mrb, mrb_value str); ...@@ -107,6 +107,9 @@ mrb_int mrb_str_hash(mrb_state *mrb, mrb_value str);
mrb_value mrb_str_dump(mrb_state *mrb, mrb_value str); mrb_value mrb_str_dump(mrb_state *mrb, mrb_value str);
mrb_value mrb_str_inspect(mrb_state *mrb, mrb_value str); mrb_value mrb_str_inspect(mrb_state *mrb, mrb_value str);
void noregexp(mrb_state *mrb, mrb_value self);
void regexp_check(mrb_state *mrb, mrb_value obj);
/* For backward compatibility */ /* For backward compatibility */
#define mrb_str_cat2(mrb, str, ptr) mrb_str_cat_cstr(mrb, str, ptr) #define mrb_str_cat2(mrb, str, ptr) mrb_str_cat_cstr(mrb, str, ptr)
#define mrb_str_buf_cat(mrb, str, ptr, len) mrb_str_cat(mrb, str, ptr, len) #define mrb_str_buf_cat(mrb, str, ptr, len) mrb_str_cat(mrb, str, ptr, len)
......
...@@ -106,21 +106,6 @@ mrb_str_size(mrb_state *mrb, mrb_value str) ...@@ -106,21 +106,6 @@ mrb_str_size(mrb_state *mrb, mrb_value str)
#define RSTRING_LEN_UTF8(s) mrb_utf8_strlen(s, -1) #define RSTRING_LEN_UTF8(s) mrb_utf8_strlen(s, -1)
static mrb_value
noregexp(mrb_state *mrb, mrb_value self)
{
mrb_raise(mrb, E_NOTIMP_ERROR, "Regexp class not implemented");
return mrb_nil_value();
}
static void
regexp_check(mrb_state *mrb, mrb_value obj)
{
if (mrb_regexp_p(mrb, obj)) {
noregexp(mrb, obj);
}
}
static inline mrb_int static inline mrb_int
mrb_memsearch_qs(const unsigned char *xs, mrb_int m, const unsigned char *ys, mrb_int n) mrb_memsearch_qs(const unsigned char *xs, mrb_int m, const unsigned char *ys, mrb_int n)
{ {
......
...@@ -637,14 +637,13 @@ mrb_string_value_ptr(mrb_state *mrb, mrb_value ptr) ...@@ -637,14 +637,13 @@ mrb_string_value_ptr(mrb_state *mrb, mrb_value ptr)
return RSTRING_PTR(str); return RSTRING_PTR(str);
} }
static mrb_value void
noregexp(mrb_state *mrb, mrb_value self) noregexp(mrb_state *mrb, mrb_value self)
{ {
mrb_raise(mrb, E_NOTIMP_ERROR, "Regexp class not implemented"); mrb_raise(mrb, E_NOTIMP_ERROR, "Regexp class not implemented");
return mrb_nil_value();
} }
static void void
regexp_check(mrb_state *mrb, mrb_value obj) regexp_check(mrb_state *mrb, mrb_value obj)
{ {
if (mrb_regexp_p(mrb, obj)) { if (mrb_regexp_p(mrb, obj)) {
......
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