mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Unify duplicated functions (noregexp() and regexp_check()).
This commit is contained in:
@@ -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_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 */
|
||||
#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)
|
||||
|
||||
@@ -106,21 +106,6 @@ mrb_str_size(mrb_state *mrb, mrb_value str)
|
||||
|
||||
#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
|
||||
mrb_memsearch_qs(const unsigned char *xs, mrb_int m, const unsigned char *ys, mrb_int n)
|
||||
{
|
||||
|
||||
+2
-3
@@ -637,14 +637,13 @@ mrb_string_value_ptr(mrb_state *mrb, mrb_value ptr)
|
||||
return RSTRING_PTR(str);
|
||||
}
|
||||
|
||||
static mrb_value
|
||||
void
|
||||
noregexp(mrb_state *mrb, mrb_value self)
|
||||
{
|
||||
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)
|
||||
{
|
||||
if (mrb_regexp_p(mrb, obj)) {
|
||||
|
||||
Reference in New Issue
Block a user