* internal.h: do not use ruby_sized_xrealloc() and ruby_sized_xfree()

if HAVE_MALLOC_USABLE_SIZE (or _WIN32) is defined.
  We don't need these function if malloc_usable_size() is available.
* gc.c: catch up this change.
* gc.c: define HAVE_MALLOC_USABLE_SIZE on _WIN32.
* array.c (ary_resize_capa): do not use ruby_sized_xfree() with
  local variable to avoid "unused local variable" warning.
  This change only has few impact.
* string.c (rb_str_resize): ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43839 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2013-11-25 01:13:31 +00:00
parent 84b7d6d533
commit 2bfd722d80
5 changed files with 32 additions and 4 deletions

View file

@ -1973,13 +1973,12 @@ rb_str_resize(VALUE str, long len)
}
else if (len + termlen <= RSTRING_EMBED_LEN_MAX + 1) {
char *ptr = STR_HEAP_PTR(str);
size_t size = STR_HEAP_SIZE(str);
STR_SET_EMBED(str);
if (slen > len) slen = len;
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_sized_xfree(ptr, size);
if (independent) ruby_xfree(ptr);
return str;
}
else if (!independent) {