summaryrefslogtreecommitdiff
path: root/re.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-04-18 08:46:18 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-04-18 08:46:18 +0000
commite63a9901412d465cd90143d658fda8fa938d7f8c (patch)
tree12cf55d22b7b78304e8a692c44217e9531a31c02 /re.c
parent8a7b08bb787c2d8d531e0b84974fb2a4bec30d87 (diff)
* re.c (rb_reg_expr_str): should treat backslash specially in
escaping. * io.c: complete off_t handling; missing argument for fptr_finalize(); polished rb_scan_args call. * dir.c: wrap multi-statment macro by do { } while (0) * eval.c, numeric,c, sprintf.c, util.c: ditto. * bignum.c (rb_big_eq): check `y == x' if y is neither Fixnum, Bignum, nor Float. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 're.c')
-rw-r--r--re.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/re.c b/re.c
index 41364a189b..2488ccba95 100644
--- a/re.c
+++ b/re.c
@@ -238,7 +238,13 @@ rb_reg_expr_str(str, s, len)
else {
p = s;
while (p<pend) {
- if (*p == '/') {
+ if (*p == '\\') {
+ rb_str_buf_cat(str, p++, 1);
+ if (p<pend) {
+ rb_str_buf_cat(str, p, 1);
+ }
+ }
+ else if (*p == '/') {
char c = '\\';
rb_str_buf_cat(str, &c, 1);
rb_str_buf_cat(str, p, 1);