summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2024-03-21 15:56:32 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2024-04-23 16:04:41 +0900
commit26ec606bcd2de68b457a9b36852b764a71083b25 (patch)
tree8b76dcfd6c667cde1312598bdcda1337a221af00 /ext
parent3229fb9769790c650cd9d11e64648daf576e11fa (diff)
Merge StringIO 3.0.1.2
Diffstat (limited to 'ext')
-rw-r--r--ext/stringio/stringio.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/stringio/stringio.c b/ext/stringio/stringio.c
index 7c34164d31..a2aef6b11c 100644
--- a/ext/stringio/stringio.c
+++ b/ext/stringio/stringio.c
@@ -12,7 +12,7 @@
**********************************************************************/
-#define STRINGIO_VERSION "3.0.1"
+#define STRINGIO_VERSION "3.0.1.2"
#include "ruby.h"
#include "ruby/io.h"
@@ -984,7 +984,7 @@ strio_unget_bytes(struct StringIO *ptr, const char *cp, long cl)
len = RSTRING_LEN(str);
rest = pos - len;
if (cl > pos) {
- long ex = (rest < 0 ? cl-pos : cl+rest);
+ long ex = cl - (rest < 0 ? pos : len);
rb_str_modify_expand(str, ex);
rb_str_set_len(str, len + ex);
s = RSTRING_PTR(str);