aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--ext/stringio/stringio.c4
2 files changed, 7 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index edcefcab6f..c612a9e377 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon Jun 30 22:27:39 2008 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * ext/stringio/stringio.c (strio_getline): fix for nil and "" as
+ separator. [ruby-dev:34591]
+
Mon Jun 30 22:21:30 2008 Yusuke Endoh <mame@tsg.ne.jp>
* io.c (argf_each_line): pass args to each_line. [ruby-dev:34958]
diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c
index b9c7eb7f80..db243c4e7e 100644
--- a/ext/stringio/stringio.c
+++ b/ext/stringio/stringio.c
@@ -835,7 +835,7 @@ strio_getline(int argc, VALUE *argv, struct StringIO *ptr)
str = tmp;
}
}
- else {
+ else if (!NIL_P(str)) {
StringValue(str);
}
}
@@ -862,7 +862,7 @@ strio_getline(int argc, VALUE *argv, struct StringIO *ptr)
s = p;
while ((p = memchr(p, '\n', e - p)) && (p != e)) {
if (*++p == '\n') {
- e = p;
+ e = p + 1;
break;
}
}