summaryrefslogtreecommitdiff
path: root/re.c
diff options
context:
space:
mode:
Diffstat (limited to 're.c')
-rw-r--r--re.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/re.c b/re.c
index dd40918f057..9954805a9af 100644
--- a/re.c
+++ b/re.c
@@ -236,9 +236,9 @@ rb_memsearch(const void *x0, long m, const void *y0, long n, rb_encoding *enc)
return 0;
}
else if (m == 1) {
- const unsigned char *ys;
+ const unsigned char *ys = memchr(y, *x, n);
- if (ys = memchr(y, *x, n))
+ if (ys)
return ys - y;
else
return -1;