mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
gc.h: evaluate the macro argument only once
* gc.h (RUBY_MARK_UNLESS_NULL): evaluate the argument only once to get rid of inadvertent side effects. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51247 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
994460c4db
commit
bb8abf62d3
2 changed files with 9 additions and 1 deletions
|
@ -1,3 +1,8 @@
|
|||
Wed Jul 15 08:59:19 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* gc.h (RUBY_MARK_UNLESS_NULL): evaluate the argument only once
|
||||
to get rid of inadvertent side effects.
|
||||
|
||||
Wed Jul 15 02:53:11 2015 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* vm_core.h, vm.c: remove rb_proc_t::envval because we can know it via
|
||||
|
|
5
gc.h
5
gc.h
|
@ -57,7 +57,10 @@ rb_gc_debug_body(const char *mode, const char *msg, int st, void *ptr)
|
|||
#define RUBY_GC_INFO if(0)printf
|
||||
#endif
|
||||
|
||||
#define RUBY_MARK_UNLESS_NULL(ptr) if(RTEST(ptr)){rb_gc_mark(ptr);}
|
||||
#define RUBY_MARK_UNLESS_NULL(ptr) do { \
|
||||
VALUE markobj = (ptr); \
|
||||
if (RTEST(markobj)) {rb_gc_mark(markobj);} \
|
||||
} while (0)
|
||||
#define RUBY_FREE_UNLESS_NULL(ptr) if(ptr){ruby_xfree(ptr);(ptr)=NULL;}
|
||||
|
||||
#if STACK_GROW_DIRECTION > 0
|
||||
|
|
Loading…
Reference in a new issue