From f7d46c88609f4991ef899059a7d16801aa245574 Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 25 Dec 2003 08:49:20 +0000 Subject: [PATCH] * string.c (rb_str_update): call rb_str_modify(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5293 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 ++++ dln.c | 7 +------ ext/tcltklib/tcltklib.c | 2 +- string.c | 26 ++++++++++++++++++-------- 4 files changed, 24 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index ab3ebce67a..0cdc277c6c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Thu Dec 25 15:30:17 2003 Yukihiro Matsumoto + + * string.c (rb_str_update): call rb_str_modify(). + Thu Dec 25 05:08:09 2003 Nobuyoshi Nakada * eval.c (search_required): search actual file name once when no diff --git a/dln.c b/dln.c index 1dd80c2fe6..67ca195f60 100644 --- a/dln.c +++ b/dln.c @@ -1115,12 +1115,7 @@ dln_sym(name) #endif /* USE_DLN_A_OUT */ #ifdef USE_DLN_DLOPEN -# ifdef __NetBSD__ -# include -# include -# else -# include -# endif +# include #endif #ifdef __hpux diff --git a/ext/tcltklib/tcltklib.c b/ext/tcltklib/tcltklib.c index ad7e377b66..a7de967838 100644 --- a/ext/tcltklib/tcltklib.c +++ b/ext/tcltklib/tcltklib.c @@ -824,7 +824,7 @@ ip_ruby(clientData, interp, argc, argv) /* status check */ if (arg.failed) { - VALUE eclass = CLASS_OF(arg.failed); + VALUE eclass = rb_obj_class(arg.failed); DUMP1("(rb_eval_string result) failed"); Tcl_ResetResult(interp); Tcl_AppendResult(interp, StringValuePtr(arg.failed), (char*)NULL); diff --git a/string.c b/string.c index 267ce2a784..f32dad275b 100644 --- a/string.c +++ b/string.c @@ -1579,8 +1579,8 @@ rb_str_aref_m(argc, argv, str) return rb_str_aref(str, argv[0]); } -void -rb_str_update(str, beg, len, val) +static void +rb_str_splice(str, beg, len, val) VALUE str; long beg, len; VALUE val; @@ -1624,6 +1624,16 @@ rb_str_update(str, beg, len, val) OBJ_INFECT(str, val); } +void +rb_str_update(str, beg, len, val) + VALUE str; + long beg, len; + VALUE val; +{ + rb_str_modify(str); + return rb_str_splice(str, beg, len, val); +} + static void rb_str_subpat_set(str, re, nth, val) VALUE str, re; @@ -1655,7 +1665,7 @@ rb_str_subpat_set(str, re, nth, val) end = RMATCH(match)->END(nth); len = end - start; rb_str_modify(str); - rb_str_update(str, start, len, val); + rb_str_splice(str, start, len, val); } static VALUE @@ -1686,7 +1696,7 @@ rb_str_aset(str, indx, val) RSTRING(str)->ptr[idx] = NUM2INT(val) & 0xff; } else { - rb_str_update(str, idx, 1, val); + rb_str_splice(str, idx, 1, val); } return val; @@ -1699,7 +1709,7 @@ rb_str_aset(str, indx, val) if (beg < 0) { rb_raise(rb_eIndexError, "string not matched"); } - rb_str_update(str, beg, RSTRING(indx)->len, val); + rb_str_splice(str, beg, RSTRING(indx)->len, val); return val; default: @@ -1707,7 +1717,7 @@ rb_str_aset(str, indx, val) { long beg, len; if (rb_range_beg_len(indx, &beg, &len, RSTRING(str)->len, 2)) { - rb_str_update(str, beg, len, val); + rb_str_splice(str, beg, len, val); return val; } } @@ -1753,7 +1763,7 @@ rb_str_aset_m(argc, argv, str) rb_str_subpat_set(str, argv[0], NUM2INT(argv[1]), argv[2]); } else { - rb_str_update(str, NUM2LONG(argv[0]), NUM2LONG(argv[1]), argv[2]); + rb_str_splice(str, NUM2LONG(argv[0]), NUM2LONG(argv[1]), argv[2]); } return argv[2]; } @@ -1793,7 +1803,7 @@ rb_str_insert(str, idx, str2) else if (pos < 0) { pos++; } - rb_str_update(str, pos, 0, str2); + rb_str_splice(str, pos, 0, str2); return str; }