diff options
| author | mimaki <[email protected]> | 2012-04-23 11:51:47 +0900 |
|---|---|---|
| committer | mimaki <[email protected]> | 2012-04-23 11:51:47 +0900 |
| commit | c80487561f291e8239541687341b4d64a840c108 (patch) | |
| tree | d4f7777cc91597cf880bed364df26066b9aaee8f /src/re.c | |
| parent | 835443614d21b13b27af3674d7f8cb9bf49c298b (diff) | |
| parent | 3f0b98762d4a49beb7cc3f9cc8a8dfcee4aa5f6f (diff) | |
| download | mruby-c80487561f291e8239541687341b4d64a840c108.tar.gz mruby-c80487561f291e8239541687341b4d64a840c108.zip | |
Merge branch 'master' of github.com:mruby/mruby
Conflicts:
src/variable.c
Diffstat (limited to 'src/re.c')
| -rw-r--r-- | src/re.c | 49 |
1 files changed, 0 insertions, 49 deletions
@@ -1778,11 +1778,7 @@ static int pair_byte_cmp(const void *pair1, const void *pair2) { long diff = ((pair_t*)pair1)->byte_pos - ((pair_t*)pair2)->byte_pos; -#if SIZEOF_LONG > SIZEOF_INT return diff ? diff > 0 ? 1 : -1 : 0; -#else - return (int)diff; -#endif } static void @@ -2964,48 +2960,6 @@ mrb_backref_set(mrb_state *mrb, mrb_value val) #ifdef INCLUDE_ENCODING static inline long -mrb_memsearch_ss(const unsigned char *xs, long m, const unsigned char *ys, long n) -{ - const unsigned char *x = xs, *xe = xs + m; - const unsigned char *y = ys, *ye = ys + n; -#define SIZEOF_VOIDP 4 -#define SIZEOF_LONG 4 - -#ifndef VALUE_MAX -# if SIZEOF_VALUE == 8 -# define VALUE_MAX 0xFFFFFFFFFFFFFFFFULL -# elif SIZEOF_VALUE == 4 -# define VALUE_MAX 0xFFFFFFFFUL -# elif SIZEOF_LONG == SIZEOF_VOIDP -# define SIZEOF_VALUE 4 -# define VALUE_MAX 0xFFFFFFFFUL -# endif -#endif - int hx, hy, mask = VALUE_MAX >> ((SIZEOF_VALUE - m) * CHAR_BIT); - - if (m > SIZEOF_VALUE) - mrb_bug("!!too long pattern string!!"); - - /* Prepare hash value */ - for (hx = *x++, hy = *y++; x < xe; ++x, ++y) { - hx <<= CHAR_BIT; - hy <<= CHAR_BIT; - hx |= *x; - hy |= *y; - } - /* Searching */ - while (hx != hy) { - if (y == ye) - return -1; - hy <<= CHAR_BIT; - hy |= *y; - hy &= mask; - y++; - } - return y - ys - m; -} - -static inline long mrb_memsearch_qs(const unsigned char *xs, long m, const unsigned char *ys, long n) { const unsigned char *x = xs, *xe = xs + m; @@ -3099,9 +3053,6 @@ mrb_memsearch(mrb_state *mrb, const void *x0, int m, const void *y0, int n, mrb_ } return -1; } - else if (m <= SIZEOF_VALUE) { - return mrb_memsearch_ss(x0, m, y0, n); - } else if (enc == mrb_utf8_encoding(mrb)) { return mrb_memsearch_qs_utf8(x0, m, y0, n); } |
