ruby-changes:31254
From: ko1 <ko1@a...>
Date: Thu, 17 Oct 2013 17:41:30 +0900 (JST)
Subject: [ruby-changes:31254] ko1:r43333 (trunk): * gc.c, internal.h: rename ruby_xsizefree/realloc to
ko1 2013-10-17 17:41:23 +0900 (Thu, 17 Oct 2013) New Revision: 43333 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=43333 Log: * gc.c, internal.h: rename ruby_xsizefree/realloc to rb_sized_free/realloc. * array.c: catch up these changes. * string.c: ditto. Modified files: trunk/ChangeLog trunk/array.c trunk/gc.c trunk/internal.h trunk/string.c Index: array.c =================================================================== --- array.c (revision 43332) +++ array.c (revision 43333) @@ -225,7 +225,7 @@ ary_resize_capa(VALUE ary, long capacity https://github.com/ruby/ruby/blob/trunk/array.c#L225 MEMCPY((VALUE *)RARRAY(ary)->as.ary, ptr, VALUE, len); FL_SET_EMBED(ary); ARY_SET_LEN(ary, len); - ruby_xsizedfree((VALUE *)ptr, size); + ruby_sized_xfree((VALUE *)ptr, size); } } } @@ -536,7 +536,7 @@ void https://github.com/ruby/ruby/blob/trunk/array.c#L536 rb_ary_free(VALUE ary) { if (ARY_OWNS_HEAP_P(ary)) { - ruby_xsizedfree((void *)ARY_HEAP_PTR(ary), ARY_HEAP_SIZE(ary)); + ruby_sized_xfree((void *)ARY_HEAP_PTR(ary), ARY_HEAP_SIZE(ary)); } } @@ -716,7 +716,7 @@ rb_ary_initialize(int argc, VALUE *argv, https://github.com/ruby/ruby/blob/trunk/array.c#L716 rb_ary_modify(ary); if (argc == 0) { if (ARY_OWNS_HEAP_P(ary) && RARRAY_CONST_PTR(ary) != 0) { - ruby_xsizedfree((void *)RARRAY_CONST_PTR(ary), ARY_HEAP_SIZE(ary)); + ruby_sized_xfree((void *)RARRAY_CONST_PTR(ary), ARY_HEAP_SIZE(ary)); } rb_ary_unshare_safe(ary); FL_SET_EMBED(ary); @@ -2436,7 +2436,7 @@ rb_ary_sort_bang(VALUE ary) https://github.com/ruby/ruby/blob/trunk/array.c#L2436 rb_ary_unshare(ary); } else { - ruby_xsizedfree((void *)ARY_HEAP_PTR(ary), ARY_HEAP_SIZE(ary)); + ruby_sized_xfree((void *)ARY_HEAP_PTR(ary), ARY_HEAP_SIZE(ary)); } ARY_SET_PTR(ary, RARRAY_CONST_PTR(tmp)); ARY_SET_HEAP_LEN(ary, len); @@ -3300,7 +3300,7 @@ rb_ary_replace(VALUE copy, VALUE orig) https://github.com/ruby/ruby/blob/trunk/array.c#L3300 VALUE shared = 0; if (ARY_OWNS_HEAP_P(copy)) { - RARRAY_PTR_USE(copy, ptr, ruby_xsizedfree(ptr, ARY_HEAP_SIZE(copy))); + RARRAY_PTR_USE(copy, ptr, ruby_sized_xfree(ptr, ARY_HEAP_SIZE(copy))); } else if (ARY_SHARED_P(copy)) { shared = ARY_SHARED(copy); @@ -3316,7 +3316,7 @@ rb_ary_replace(VALUE copy, VALUE orig) https://github.com/ruby/ruby/blob/trunk/array.c#L3316 else { VALUE shared = ary_make_shared(orig); if (ARY_OWNS_HEAP_P(copy)) { - RARRAY_PTR_USE(copy, ptr, ruby_xsizedfree(ptr, ARY_HEAP_SIZE(copy))); + RARRAY_PTR_USE(copy, ptr, ruby_sized_xfree(ptr, ARY_HEAP_SIZE(copy))); } else { rb_ary_unshare_safe(copy); Index: ChangeLog =================================================================== --- ChangeLog (revision 43332) +++ ChangeLog (revision 43333) @@ -1,3 +1,12 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Thu Oct 17 17:38:36 2013 Koichi Sasada <ko1@a...> + + * gc.c, internal.h: rename ruby_xsizefree/realloc to + rb_sized_free/realloc. + + * array.c: catch up these changes. + + * string.c: ditto. + Thu Oct 17 17:32:51 2013 Koichi Sasada <ko1@a...> * array.c, string.c: use ruby_xsizedfree() and ruby_xsizedrealloc(). Index: string.c =================================================================== --- string.c (revision 43332) +++ string.c (revision 43333) @@ -883,7 +883,7 @@ rb_str_free(VALUE str) https://github.com/ruby/ruby/blob/trunk/string.c#L883 st_delete(frozen_strings, &fstr, NULL); } if (!STR_EMBED_P(str) && !STR_SHARED_P(str)) { - ruby_xsizedfree(STR_HEAP_PTR(str), STR_HEAP_SIZE(str)); + ruby_sized_xfree(STR_HEAP_PTR(str), STR_HEAP_SIZE(str)); } } @@ -1466,7 +1466,7 @@ str_discard(VALUE str) https://github.com/ruby/ruby/blob/trunk/string.c#L1466 { str_modifiable(str); if (!STR_SHARED_P(str) && !STR_EMBED_P(str)) { - ruby_xsizedfree(STR_HEAP_PTR(str), STR_HEAP_SIZE(str)); + ruby_sized_xfree(STR_HEAP_PTR(str), STR_HEAP_SIZE(str)); RSTRING(str)->as.heap.ptr = 0; RSTRING(str)->as.heap.len = 0; } @@ -1990,7 +1990,7 @@ rb_str_resize(VALUE str, long len) https://github.com/ruby/ruby/blob/trunk/string.c#L1990 if (slen > 0) MEMCPY(RSTRING(str)->as.ary, ptr, char, slen); TERM_FILL(RSTRING(str)->as.ary + len, termlen); STR_SET_EMBED_LEN(str, len); - if (independent) ruby_xsizedfree(ptr, size); + if (independent) ruby_sized_xfree(ptr, size); return str; } else if (!independent) { @@ -5501,7 +5501,7 @@ tr_trans(VALUE str, VALUE src, VALUE rep https://github.com/ruby/ruby/blob/trunk/string.c#L5501 t += tlen; } if (!STR_EMBED_P(str)) { - ruby_xsizedfree(STR_HEAP_PTR(str), STR_HEAP_SIZE(str)); + ruby_sized_xfree(STR_HEAP_PTR(str), STR_HEAP_SIZE(str)); } *t = '\0'; RSTRING(str)->as.heap.ptr = buf; @@ -5577,7 +5577,7 @@ tr_trans(VALUE str, VALUE src, VALUE rep https://github.com/ruby/ruby/blob/trunk/string.c#L5577 t += tlen; } if (!STR_EMBED_P(str)) { - ruby_xsizedfree(STR_HEAP_PTR(str), STR_HEAP_SIZE(str)); + ruby_sized_xfree(STR_HEAP_PTR(str), STR_HEAP_SIZE(str)); } *t = '\0'; RSTRING(str)->as.heap.ptr = buf; Index: gc.c =================================================================== --- gc.c (revision 43332) +++ gc.c (revision 43333) @@ -5045,7 +5045,7 @@ ruby_xcalloc(size_t n, size_t size) https://github.com/ruby/ruby/blob/trunk/gc.c#L5045 } void * -ruby_xsizedrealloc(void *ptr, size_t new_size, size_t old_size) +ruby_sized_xrealloc(void *ptr, size_t new_size, size_t old_size) { return vm_xrealloc(&rb_objspace, ptr, new_size, old_size); } @@ -5053,7 +5053,7 @@ ruby_xsizedrealloc(void *ptr, size_t new https://github.com/ruby/ruby/blob/trunk/gc.c#L5053 void * ruby_xrealloc(void *ptr, size_t new_size) { - return ruby_xsizedrealloc(ptr, new_size, 0); + return ruby_sized_xrealloc(ptr, new_size, 0); } void * @@ -5067,7 +5067,7 @@ ruby_xrealloc2(void *ptr, size_t n, size https://github.com/ruby/ruby/blob/trunk/gc.c#L5067 } void -ruby_xsizedfree(void *x, size_t size) +ruby_sized_xfree(void *x, size_t size) { if (x) { vm_xfree(&rb_objspace, x, size); @@ -5077,7 +5077,7 @@ ruby_xsizedfree(void *x, size_t size) https://github.com/ruby/ruby/blob/trunk/gc.c#L5077 void ruby_xfree(void *x) { - ruby_xsizedfree(x, 0); + ruby_sized_xfree(x, 0); } /* Mimic ruby_xmalloc, but need not rb_objspace. Index: internal.h =================================================================== --- internal.h (revision 43332) +++ internal.h (revision 43333) @@ -432,9 +432,9 @@ void *ruby_mimmalloc(size_t size); https://github.com/ruby/ruby/blob/trunk/internal.h#L432 void rb_objspace_set_event_hook(const rb_event_flag_t event); void rb_gc_writebarrier_remember_promoted(VALUE obj); -void *ruby_xsizedrealloc(void *ptr, size_t new_size, size_t old_size) RUBY_ATTR_ALLOC_SIZE((2));; -void ruby_xsizedfree(void *x, size_t size); -#define SIZED_REALLOC_N(var,type,n,old_n) ((var)=(type*)ruby_xsizedrealloc((char*)(var), (n) * sizeof(type), (old_n) * sizeof(type))) +void *ruby_sized_xrealloc(void *ptr, size_t new_size, size_t old_size) RUBY_ATTR_ALLOC_SIZE((2));; +void ruby_sized_xfree(void *x, size_t size); +#define SIZED_REALLOC_N(var,type,n,old_n) ((var)=(type*)ruby_sized_xrealloc((char*)(var), (n) * sizeof(type), (old_n) * sizeof(type))) /* hash.c */ struct st_table *rb_hash_tbl_raw(VALUE hash); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/