diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-11-25 01:13:31 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-11-25 01:13:31 +0000 |
commit | 2bfd722d803ac26deabde267c3d84d1b1aa85f50 (patch) | |
tree | cb6d1f0b15b37e231800701b38f2f663e3b4e3c0 /internal.h | |
parent | 84b7d6d533208bb9f73e3573ad2352dcf9e2e1b0 (diff) | |
download | ruby-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 'internal.h')
-rw-r--r-- | internal.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/internal.h b/internal.h index 963192d27b..289561306b 100644 --- a/internal.h +++ b/internal.h @@ -439,9 +439,15 @@ void rb_objspace_set_event_hook(const rb_event_flag_t event); void rb_gc_writebarrier_remember_promoted(VALUE obj); void ruby_gc_set_params(void); +#if HAVE_MALLOC_USABLE_SIZE || defined(_WIN32) +#define ruby_sized_xrealloc(ptr, new_size, old_size) ruby_xrealloc(ptr, new_size) +#define ruby_sized_xfree(ptr, size) ruby_xfree(ptr) +#define SIZED_REALLOC_N(var,type,n,old_n) REALLOC_N(var, type, n) +#else 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))) +#endif void rb_gc_resurrect(VALUE ptr); |