summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
Diffstat (limited to 'string.c')
-rw-r--r--string.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/string.c b/string.c
index 28a1b293d6..0607726a07 100644
--- a/string.c
+++ b/string.c
@@ -8246,6 +8246,21 @@ chomp_newline(const char *p, const char *e, rb_encoding *enc)
}
static VALUE
+get_rs(void)
+{
+ VALUE rs = rb_rs;
+ if (!NIL_P(rs) &&
+ (!RB_TYPE_P(rs, T_STRING) ||
+ RSTRING_LEN(rs) != 1 ||
+ RSTRING_PTR(rs)[0] != '\n')) {
+ rb_warn("$/ is set to non-default value");
+ }
+ return rs;
+}
+
+#define rb_rs get_rs()
+
+static VALUE
rb_str_enumerate_lines(int argc, VALUE *argv, VALUE str, VALUE ary)
{
rb_encoding *enc;