Guest User

Untitled

a guest
May 22nd, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. VALUE
  2. rb_str_plus(str1, str2)
  3. VALUE str1, str2;
  4. {
  5. VALUE str3;
  6.  
  7. StringValue(str2);
  8. str3 = rb_str_new(0, RSTRING(str1)->len+RSTRING(str2)->len);
  9. memcpy(RSTRING(str3)->ptr, RSTRING(str1)->ptr, RSTRING(str1)->len);
  10. memcpy(RSTRING(str3)->ptr + RSTRING(str1)->len,
  11. RSTRING(str2)->ptr, RSTRING(str2)->len);
  12. RSTRING(str3)->ptr[RSTRING(str3)->len] = '\0';
  13.  
  14. if (OBJ_TAINTED(str1) || OBJ_TAINTED(str2))
  15. OBJ_TAINT(str3);
  16. return str3;
  17. }
Add Comment
Please, Sign In to add comment