reduce RSTRING_PTR usage