diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-04-10 05:48:43 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-04-10 05:48:43 +0000 |
commit | 620b13d8777086b3b4da0e0a07e93b83ea38b66d (patch) | |
tree | 6dcd08ef584fc777cf34517136d5ce3948840e45 /string.c | |
parent | 0453f53db62f1321492288d1c904aade9bb0fa3e (diff) | |
download | ruby-620b13d8777086b3b4da0e0a07e93b83ea38b66d.tar.gz ruby-620b13d8777086b3b4da0e0a07e93b83ea38b66d.tar.xz ruby-620b13d8777086b3b4da0e0a07e93b83ea38b66d.zip |
2000-04-10
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@661 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 25 |
1 files changed, 21 insertions, 4 deletions
@@ -414,10 +414,28 @@ rb_str_cat(str, ptr, len) } VALUE +rb_str_cat2(str, ptr) + VALUE str; + const char *ptr; +{ + return rb_str_cat(str, ptr, strlen(ptr)); +} + +VALUE +rb_str_append(str1, str2) + VALUE str1, str2; +{ + if (TYPE(str2) != T_STRING) str2 = rb_str_to_str(str2); + str1 = rb_str_cat(str1, RSTRING(str2)->ptr, RSTRING(str2)->len); + OBJ_INFECT(str1, str2); + + return str1; +} + +VALUE rb_str_concat(str1, str2) VALUE str1, str2; { - rb_str_modify(str1); if (FIXNUM_P(str2)) { int i = FIX2INT(str2); if (0 <= i && i <= 0xff) { /* byte */ @@ -425,9 +443,8 @@ rb_str_concat(str1, str2) return rb_str_cat(str1, &c, 1); } } - if (TYPE(str2) != T_STRING) str2 = rb_str_to_str(str2); - str1 = rb_str_cat(str1, RSTRING(str2)->ptr, RSTRING(str2)->len); - if (OBJ_TAINTED(str2)) OBJ_TAINT(str1); + str1 = rb_str_append(str1, str2); + return str1; } |