1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

string.c: rb_str_cat_cstr

* string.c (rb_str_cat): make non-buf version main.

* string.c (rb_str_cat_cstr): rename from rb_str_cat2.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45609 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-04-17 05:22:57 +00:00
parent 3d69324be3
commit 37dffb599d
5 changed files with 17 additions and 12 deletions

2
NEWS
View file

@ -105,3 +105,5 @@ with all sufficient information, see the ChangeLog file.
* struct RSymbol added. This represents a dynamic symbol as object in
Ruby's heaps.
* rb_str_cat_cstr() added. This is same as `rb_str_cat2()`.

View file

@ -208,6 +208,7 @@ rb_str_cat(VALUE str, const char *ptr, long len) ::
Appends len bytes of data from ptr to the Ruby string.
rb_str_cat2(VALUE str, const char* ptr) ::
rb_str_cat_cstr(VALUE str, const char* ptr) ::
Appends C string ptr to Ruby string str. This function is
equivalent to rb_str_cat(str, ptr, strlen(ptr)).

View file

@ -234,6 +234,7 @@ rb_str_cat(VALUE str, const char *ptr, long len)
Rubyの文字列strにlenバイトの文字列ptrを追加する
rb_str_cat2(VALUE str, const char* ptr)
rb_str_cat_cstr(VALUE str, const char* ptr)
Rubyの文字列strにCの文字列ptrを追加するこの関数の機能は
rb_str_cat(str, ptr, strlen(ptr))と同等である.

View file

@ -727,6 +727,7 @@ VALUE rb_str_freeze(VALUE);
void rb_str_set_len(VALUE, long);
VALUE rb_str_resize(VALUE, long);
VALUE rb_str_cat(VALUE, const char*, long);
VALUE rb_str_cat_cstr(VALUE, const char*);
VALUE rb_str_cat2(VALUE, const char*);
VALUE rb_str_append(VALUE, VALUE);
VALUE rb_str_concat(VALUE, VALUE);
@ -798,17 +799,11 @@ VALUE rb_str_scrub(VALUE, VALUE);
(str), (long)strlen(str)) : \
rb_str_buf_new_cstr(str); \
})
#define rb_str_buf_cat2(str, ptr) __extension__ ( \
{ \
(__builtin_constant_p(ptr)) ? \
rb_str_buf_cat((str), (ptr), (long)strlen(ptr)) : \
rb_str_buf_cat2((str), (ptr)); \
})
#define rb_str_cat2(str, ptr) __extension__ ( \
#define rb_str_cat_cstr(str, ptr) __extension__ ( \
{ \
(__builtin_constant_p(ptr)) ? \
rb_str_cat((str), (ptr), (long)strlen(ptr)) : \
rb_str_cat2((str), (ptr)); \
rb_str_cat_cstr((str), (ptr)); \
})
#define rb_exc_new_cstr(klass, ptr) __extension__ ( \
{ \
@ -824,6 +819,9 @@ VALUE rb_str_scrub(VALUE, VALUE);
#define rb_tainted_str_new2 rb_tainted_str_new_cstr
#define rb_str_buf_new2 rb_str_buf_new_cstr
#define rb_usascii_str_new2 rb_usascii_str_new_cstr
#define rb_str_buf_cat rb_str_cat
#define rb_str_buf_cat2 rb_str_cat_cstr
#define rb_str_cat2 rb_str_cat_cstr
/* struct.c */
VALUE rb_struct_new(VALUE, ...);
VALUE rb_struct_define(const char*, ...);

View file

@ -38,8 +38,10 @@
#undef rb_locale_str_new_cstr
#undef rb_str_dup_frozen
#undef rb_str_buf_new_cstr
#undef rb_str_buf_cat
#undef rb_str_buf_cat2
#undef rb_str_cat2
#undef rb_str_cat_cstr
static VALUE rb_str_clear(VALUE str);
@ -2048,7 +2050,7 @@ str_buf_cat(VALUE str, const char *ptr, long len)
#define str_buf_cat2(str, ptr) str_buf_cat((str), (ptr), strlen(ptr))
VALUE
rb_str_buf_cat(VALUE str, const char *ptr, long len)
rb_str_cat(VALUE str, const char *ptr, long len)
{
if (len == 0) return str;
if (len < 0) {
@ -2058,13 +2060,14 @@ rb_str_buf_cat(VALUE str, const char *ptr, long len)
}
VALUE
rb_str_buf_cat2(VALUE str, const char *ptr)
rb_str_cat_cstr(VALUE str, const char *ptr)
{
return rb_str_buf_cat(str, ptr, strlen(ptr));
}
RUBY_ALIAS_FUNCTION(rb_str_cat(VALUE str, const char *ptr, long len), rb_str_buf_cat, (str, ptr, len))
RUBY_ALIAS_FUNCTION(rb_str_cat2(VALUE str, const char *ptr), rb_str_buf_cat2, (str, ptr))
RUBY_ALIAS_FUNCTION(rb_str_buf_cat(VALUE str, const char *ptr, long len), rb_str_cat, (str, ptr, len))
RUBY_ALIAS_FUNCTION(rb_str_buf_cat2(VALUE str, const char *ptr), rb_str_cat_cstr, (str, ptr))
RUBY_ALIAS_FUNCTION(rb_str_cat2(VALUE str, const char *ptr), rb_str_cat_cstr, (str, ptr))
static VALUE
rb_enc_cr_str_buf_cat(VALUE str, const char *ptr, long len,