ruby-changes:53072
From: naruse <ko1@a...>
Date: Mon, 22 Oct 2018 01:37:30 +0900 (JST)
Subject: [ruby-changes:53072] naruse:r65286 (trunk): Use inline function with stable code instead of macro
naruse 2018-10-22 01:37:24 +0900 (Mon, 22 Oct 2018) New Revision: 65286 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=65286 Log: Use inline function with stable code instead of macro Modified files: trunk/addr2line.c Index: addr2line.c =================================================================== --- addr2line.c (revision 65285) +++ addr2line.c (revision 65286) @@ -159,9 +159,25 @@ typedef struct obj_info { https://github.com/ruby/ruby/blob/trunk/addr2line.c#L159 struct dwarf_section debug_str; struct obj_info *next; } obj_info_t; -#define obj_dwarf_section_at(obj,n) (&obj->debug_abbrev + n) + #define DWARF_SECTION_COUNT 5 +static struct dwarf_section * +obj_dwarf_section_at(obj_info_t *obj, int n) +{ + struct dwarf_section *ary[] = { + &obj->debug_abbrev, + &obj->debug_info, + &obj->debug_line, + &obj->debug_ranges, + &obj->debug_str + }; + if (n < 0 || DWARF_SECTION_COUNT <= n) { + abort(); + } + return ary[n]; +} + struct debug_section_definition { const char *name; struct dwarf_section *dwarf; -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/