/* * call-seq: * str + other_str => new_str * * Concatenation---Returns a new <code>String</code> containing * <i>other_str</i> concatenated to <i>str</i>. * * "Hello from " + self.to_s #=> "Hello from main" */ VALUE rb_str_plus(str1, str2) VALUE str1, str2; { VALUE str3; StringValue(str2); str3 = rb_str_new(0, RSTRING(str1)->len+RSTRING(str2)->len); memcpy(RSTRING(str3)->ptr, RSTRING(str1)->ptr, RSTRING(str1)->len); memcpy(RSTRING(str3)->ptr + RSTRING(str1)->len, RSTRING(str2)->ptr, RSTRING(str2)->len); RSTRING(str3)->ptr[RSTRING(str3)->len] = '\0'; if (OBJ_TAINTED(str1) || OBJ_TAINTED(str2)) OBJ_TAINT(str3); return str3; }