Skip to content

Commit bb9eea9

Browse files
committed
Make local functions static
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 73496fd commit bb9eea9

File tree

1 file changed

+45
-24
lines changed

1 file changed

+45
-24
lines changed

addr2line.c

+45-24
Original file line numberDiff line numberDiff line change
@@ -788,42 +788,48 @@ get_uint64(const uint8_t *p)
788788
}
789789

790790
static uint8_t
791-
read_uint8(char **ptr) {
791+
read_uint8(char **ptr)
792+
{
792793
const unsigned char *p = (const unsigned char *)*ptr;
793794
*ptr = (char *)(p + 1);
794795
return *p;
795796
}
796797

797798
static uint16_t
798-
read_uint16(char **ptr) {
799+
read_uint16(char **ptr)
800+
{
799801
const unsigned char *p = (const unsigned char *)*ptr;
800802
*ptr = (char *)(p + 2);
801803
return get_uint16(p);
802804
}
803805

804806
static uint32_t
805-
read_uint24(char **ptr) {
807+
read_uint24(char **ptr)
808+
{
806809
const unsigned char *p = (const unsigned char *)*ptr;
807810
*ptr = (char *)(p + 3);
808811
return (*p << 16) | get_uint16(p+1);
809812
}
810813

811814
static uint32_t
812-
read_uint32(char **ptr) {
815+
read_uint32(char **ptr)
816+
{
813817
const unsigned char *p = (const unsigned char *)*ptr;
814818
*ptr = (char *)(p + 4);
815819
return get_uint32(p);
816820
}
817821

818822
static uint64_t
819-
read_uint64(char **ptr) {
823+
read_uint64(char **ptr)
824+
{
820825
const unsigned char *p = (const unsigned char *)*ptr;
821826
*ptr = (char *)(p + 8);
822827
return get_uint64(p);
823828
}
824829

825-
uint64_t
826-
read_uint(DebugInfoReader *reader) {
830+
static uint64_t
831+
read_uint(DebugInfoReader *reader)
832+
{
827833
uint64_t v;
828834
if (reader->format == 32) {
829835
v = read_uint32(&reader->p);
@@ -833,13 +839,13 @@ read_uint(DebugInfoReader *reader) {
833839
return v;
834840
}
835841

836-
uint64_t
842+
static uint64_t
837843
read_uleb128(DebugInfoReader *reader)
838844
{
839845
return uleb128(&reader->p);
840846
}
841847

842-
int64_t
848+
static int64_t
843849
read_sleb128(DebugInfoReader *reader)
844850
{
845851
return sleb128(&reader->p);
@@ -1176,7 +1182,8 @@ debug_info_reader_read_value(DebugInfoReader *reader, uint64_t form, DebugInfoVa
11761182

11771183
/* find abbrev in current compilation unit */
11781184
static char *
1179-
di_find_abbrev(DebugInfoReader *reader, uint64_t abbrev_number) {
1185+
di_find_abbrev(DebugInfoReader *reader, uint64_t abbrev_number)
1186+
{
11801187
char *p;
11811188
if (abbrev_number < ABBREV_TABLE_SIZE) {
11821189
return reader->abbrev_table[abbrev_number];
@@ -1210,7 +1217,8 @@ di_find_abbrev(DebugInfoReader *reader, uint64_t abbrev_number) {
12101217

12111218
#if 0
12121219
static void
1213-
div_inspect(DebugInfoValue *v) {
1220+
div_inspect(DebugInfoValue *v)
1221+
{
12141222
switch (v->type) {
12151223
case VAL_uint:
12161224
fprintf(stderr,"%d: type:%d size:%zx v:%lx\n",__LINE__,v->type,v->size,v->as.uint64);
@@ -1230,7 +1238,8 @@ div_inspect(DebugInfoValue *v) {
12301238
#endif
12311239

12321240
static DIE *
1233-
di_read_die(DebugInfoReader *reader, DIE *die) {
1241+
di_read_die(DebugInfoReader *reader, DIE *die)
1242+
{
12341243
uint64_t abbrev_number = uleb128(&reader->p);
12351244
if (abbrev_number == 0) {
12361245
reader->level--;
@@ -1249,7 +1258,8 @@ di_read_die(DebugInfoReader *reader, DIE *die) {
12491258
}
12501259

12511260
static DebugInfoValue *
1252-
di_read_record(DebugInfoReader *reader, DebugInfoValue *vp) {
1261+
di_read_record(DebugInfoReader *reader, DebugInfoValue *vp)
1262+
{
12531263
uint64_t at = uleb128(&reader->q);
12541264
uint64_t form = uleb128(&reader->q);
12551265
if (!at || !form) return NULL;
@@ -1260,7 +1270,8 @@ di_read_record(DebugInfoReader *reader, DebugInfoValue *vp) {
12601270
}
12611271

12621272
static void
1263-
di_skip_records(DebugInfoReader *reader) {
1273+
di_skip_records(DebugInfoReader *reader)
1274+
{
12641275
for (;;) {
12651276
DebugInfoValue v = {{}};
12661277
uint64_t at = uleb128(&reader->q);
@@ -1280,25 +1291,29 @@ typedef struct {
12801291
} ranges_t;
12811292

12821293
static void
1283-
ranges_set_low_pc(ranges_t *ptr, uint64_t low_pc) {
1294+
ranges_set_low_pc(ranges_t *ptr, uint64_t low_pc)
1295+
{
12841296
ptr->low_pc = low_pc;
12851297
ptr->low_pc_set = true;
12861298
}
12871299

12881300
static void
1289-
ranges_set_high_pc(ranges_t *ptr, uint64_t high_pc) {
1301+
ranges_set_high_pc(ranges_t *ptr, uint64_t high_pc)
1302+
{
12901303
ptr->high_pc = high_pc;
12911304
ptr->high_pc_set = true;
12921305
}
12931306

12941307
static void
1295-
ranges_set_ranges(ranges_t *ptr, uint64_t ranges) {
1308+
ranges_set_ranges(ranges_t *ptr, uint64_t ranges)
1309+
{
12961310
ptr->ranges = ranges;
12971311
ptr->ranges_set = true;
12981312
}
12991313

13001314
static uintptr_t
1301-
ranges_include(DebugInfoReader *reader, ranges_t *ptr, uint64_t addr) {
1315+
ranges_include(DebugInfoReader *reader, ranges_t *ptr, uint64_t addr)
1316+
{
13021317
if (ptr->high_pc_set) {
13031318
if (ptr->ranges_set || !ptr->low_pc_set) {
13041319
exit(1);
@@ -1328,7 +1343,8 @@ ranges_include(DebugInfoReader *reader, ranges_t *ptr, uint64_t addr) {
13281343

13291344
#if 0
13301345
static void
1331-
ranges_inspect(DebugInfoReader *reader, ranges_t *ptr) {
1346+
ranges_inspect(DebugInfoReader *reader, ranges_t *ptr)
1347+
{
13321348
if (ptr->high_pc_set) {
13331349
if (ptr->ranges_set || !ptr->low_pc_set) {
13341350
fprintf(stderr,"low_pc_set:%d high_pc_set:%d ranges_set:%d\n",ptr->low_pc_set,ptr->high_pc_set,ptr->ranges_set);
@@ -1358,7 +1374,8 @@ ranges_inspect(DebugInfoReader *reader, ranges_t *ptr) {
13581374
#endif
13591375

13601376
static void
1361-
read_abstract_origin(DebugInfoReader *reader, uint64_t abstract_origin, line_info_t *line) {
1377+
read_abstract_origin(DebugInfoReader *reader, uint64_t abstract_origin, line_info_t *line)
1378+
{
13621379
char *p = reader->p;
13631380
char *q = reader->q;
13641381
int level = reader->level;
@@ -1490,7 +1507,9 @@ uncompress_debug_section(ElfW(Shdr) *shdr, char *file, char **ptr)
14901507
return 0;
14911508
}
14921509

1493-
void hexdump0(const unsigned char *p, size_t n) {
1510+
static void
1511+
hexdump0(const unsigned char *p, size_t n)
1512+
{
14941513
size_t i;
14951514
fprintf(stderr, " 0 1 2 3 4 5 6 7 8 9 A B C D E F\n");
14961515
for (i=0; i < n; i++){
@@ -1766,7 +1785,8 @@ main_exe_path(void)
17661785
#endif
17671786

17681787
static void
1769-
print_line0(line_info_t *line, void *address) {
1788+
print_line0(line_info_t *line, void *address)
1789+
{
17701790
uintptr_t addr = (uintptr_t)address;
17711791
uintptr_t d = addr - line->saddr;
17721792
if (!address) {
@@ -1803,7 +1823,8 @@ print_line0(line_info_t *line, void *address) {
18031823
}
18041824

18051825
static void
1806-
print_line(line_info_t *line, void *address) {
1826+
print_line(line_info_t *line, void *address)
1827+
{
18071828
print_line0(line, address);
18081829
if (line->next) {
18091830
print_line(line->next, NULL);
@@ -1946,7 +1967,7 @@ rb_dump_backtrace_with_lines(int num_traces, void **traces)
19461967
#define MAXNBUF (sizeof(intmax_t) * CHAR_BIT + 1)
19471968
static inline int toupper(int c) { return ('A' <= c && c <= 'Z') ? (c&0x5f) : c; }
19481969
#define hex2ascii(hex) (hex2ascii_data[hex])
1949-
char const hex2ascii_data[] = "0123456789abcdefghijklmnopqrstuvwxyz";
1970+
static const char hex2ascii_data[] = "0123456789abcdefghijklmnopqrstuvwxyz";
19501971
static inline int imax(int a, int b) { return (a > b ? a : b); }
19511972
static int kvprintf(char const *fmt, void (*func)(int), void *arg, int radix, va_list ap);
19521973

0 commit comments

Comments
 (0)