patch.diff

Masaki Matsushita, 04/17/2012 11:32 PM

Download (1.96 KB)

View differences:

configure.in
1432 1432
	      setuid setgid daemon select_large_fdset setenv unsetenv\
1433 1433
              mktime timegm gmtime_r clock_gettime gettimeofday poll ppoll\
1434 1434
              pread sendfile shutdown sigaltstack dl_iterate_phdr\
1435
              dup3 pipe2 posix_memalign memalign)
1435
              dup3 pipe2 posix_memalign memalign memmem)
1436 1436

  
1437 1437
AC_CACHE_CHECK(for unsetenv returns a value, rb_cv_unsetenv_return_value,
1438 1438
  [AC_TRY_COMPILE([
......
2733 2733
    ])])
2734 2734
fi
2735 2735

  
2736
AC_CACHE_CHECK(for broken memmem, rb_cv_broken_memmem,
2737
  [AC_TRY_RUN([
2738
#include <string.h>
2739

  
2740
int
2741
main()
2742
{
2743
  char *str = "hogefugafoobar";
2744
  char *rs = "foo";
2745
  char *empty = "";
2746
  char *p;
2747

  
2748
  p = memmem(str, strlen(str), rs, strlen(rs));
2749
  if (p == str+8) {
2750
    p = memmem(str, strlen(str), empty, strlen(empty));
2751
    if (p == str)
2752
      return 0;
2753
    else
2754
      return 1;
2755
  }
2756
  else {
2757
    return 1;
2758
  }
2759
}
2760
  ],
2761
  rb_cv_broken_memmem=no,
2762
  rb_cv_broken_memmem=yes,
2763
  rb_cv_broken_memmem=yes)
2764
])
2765

  
2766
if test "$rb_cv_broken_memmem" = yes; then
2767
  AC_DEFINE(BROKEN_MEMMEM, 1)
2768
fi
2769

  
2736 2770
CPPFLAGS="$CPPFLAGS "'$(DEFS)'
2737 2771
test -z "$CPPFLAGS" || CPPFLAGS="$CPPFLAGS "; CPPFLAGS="$CPPFLAGS"'${cppflags}'
2738 2772
if test -n "${cflags+set}"; then
re.c
228 228
	return -1;
229 229
    }
230 230
    else if (m <= SIZEOF_VALUE) {
231
#if defined(HAVE_MEMMEM) && !defined(BROKEN_MEMMEM)
232
	const unsigned char *ys;
233

  
234
	if (ys = memmem(y, n, x, m))
235
	    return ys - y;
236
	else
237
	    return -1;
238
#else
231 239
	return rb_memsearch_ss(x0, m, y0, n);
240
#endif
232 241
    }
233 242
    else if (enc == rb_utf8_encoding()){
234 243
	return rb_memsearch_qs_utf8(x0, m, y0, n);