ruby-changes:33469
From: nobu <ko1@a...>
Date: Thu, 10 Apr 2014 12:40:42 +0900 (JST)
Subject: [ruby-changes:33469] nobu:r45548 (trunk): gc.c: check rgengc_report argument
nobu 2014-04-10 12:40:34 +0900 (Thu, 10 Apr 2014) New Revision: 45548 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45548 Log: gc.c: check rgengc_report argument * gc.c (rgengc_report): use __VA_ARGS__ if possible. * gc.c (rgengc_report_body): check argument. * gc.c (heap_page_allocate): fix missing argument. Modified files: trunk/gc.c Index: gc.c =================================================================== --- gc.c (revision 45547) +++ gc.c (revision 45548) @@ -692,8 +692,13 @@ static inline void gc_prof_set_heap_info https://github.com/ruby/ruby/blob/trunk/gc.c#L692 #define gc_prof_record(objspace) (objspace)->profile.current_record #define gc_prof_enabled(objspace) ((objspace)->profile.run && (objspace)->profile.current_record) -#define rgengc_report if (RGENGC_DEBUG) rgengc_report_body -static void rgengc_report_body(int level, rb_objspace_t *objspace, const char *fmt, ...); +#ifdef HAVE_VA_ARGS_MACRO +# define rgengc_report(level, objspace, fmt, ...) \ + if ((level) > RGENGC_DEBUG) {} else rgengc_report_body(level, objspace, fmt, ##__VA_ARGS__) +#else +# define rgengc_report if (!(RGENGC_DEBUG)) {} else rgengc_report_body +#endif +PRINTF_ARGS(static void rgengc_report_body(int level, rb_objspace_t *objspace, const char *fmt, ...), 3, 4); static const char * type_name(int type, VALUE obj); static const char *obj_type_name(VALUE obj); @@ -1111,7 +1116,7 @@ heap_page_allocate(rb_objspace_t *objspa https://github.com/ruby/ruby/blob/trunk/gc.c#L1116 page_body->header.page = page; for (p = start; p != end; p++) { - rgengc_report(3, objspace, "assign_heap_page: %p is added to freelist\n"); + rgengc_report(3, objspace, "assign_heap_page: %p is added to freelist\n", p); heap_page_add_freeobj(objspace, page, (VALUE)p); } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/