aboutsummaryrefslogtreecommitdiffstats
path: root/gc.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-25 01:13:31 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-25 01:13:31 +0000
commit2bfd722d803ac26deabde267c3d84d1b1aa85f50 (patch)
treecb6d1f0b15b37e231800701b38f2f663e3b4e3c0 /gc.c
parent84b7d6d533208bb9f73e3573ad2352dcf9e2e1b0 (diff)
downloadruby-2bfd722d803ac26deabde267c3d84d1b1aa85f50.tar.gz
* 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
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gc.c b/gc.c
index fa073451dd..f5ef4cfa3e 100644
--- a/gc.c
+++ b/gc.c
@@ -37,6 +37,7 @@
#ifndef HAVE_MALLOC_USABLE_SIZE
# ifdef _WIN32
+# define HAVE_MALLOC_USABLE_SIZE
# define malloc_usable_size(a) _msize(a)
# endif
#else
@@ -5753,6 +5754,9 @@ ruby_xcalloc(size_t n, size_t size)
return vm_xcalloc(&rb_objspace, n, size);
}
+#ifdef ruby_sized_xrealloc
+#undef ruby_sized_xrealloc
+#endif
void *
ruby_sized_xrealloc(void *ptr, size_t new_size, size_t old_size)
{
@@ -5775,6 +5779,9 @@ ruby_xrealloc2(void *ptr, size_t n, size_t size)
return ruby_xrealloc(ptr, len);
}
+#ifdef ruby_sized_xfree
+#undef ruby_sized_xfree
+#endif
void
ruby_sized_xfree(void *x, size_t size)
{