1. Summary
  2. Files
  3. Support
  4. Report Spam
  5. Create account
  6. Log in

Changeset 1038

Show
Ignore:
Timestamp:
07/15/10 15:12:39 (3 years ago)
Author:
kaiwang27
Message:

Statify functions and global vars.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/size/size.c

    r1037 r1038  
    8888}; 
    8989 
    90 uint64_t bss_size, data_size, text_size, total_size; 
    91 uint64_t bss_size_total, data_size_total, text_size_total; 
    92  
    93 int show_totals; 
    94  
    95 enum radix_style radix  = RADIX_DECIMAL; 
    96 enum output_style style = STYLE_BERKELEY; 
    97  
    98 const char *default_args[2] = { "a.out", NULL }; 
    99  
    100 enum { 
    101         OPT_FORMAT, 
    102         OPT_RADIX 
    103 }; 
    104  
    105 struct { 
     90static uint64_t bss_size, data_size, text_size, total_size; 
     91static uint64_t bss_size_total, data_size_total, text_size_total; 
     92static int show_totals; 
     93static int size_option; 
     94static enum radix_style radix = RADIX_DECIMAL; 
     95static enum output_style style = STYLE_BERKELEY; 
     96static const char *default_args[2] = { "a.out", NULL }; 
     97 
     98static struct { 
    10699        int row; 
    107100        int col; 
     
    110103} *tb; 
    111104 
    112 int     size_option; 
     105enum { 
     106        OPT_FORMAT, 
     107        OPT_RADIX 
     108}; 
    113109 
    114110static struct option size_longopts[] = { 
     
    121117}; 
    122118 
    123 void    berkeley_calc(GElf_Shdr *); 
    124 void    berkeley_footer(const char *, const char *, const char *); 
    125 void    berkeley_header(void); 
    126 void    berkeley_totals(void); 
    127 int     handle_core(char const *, Elf *elf, GElf_Ehdr *); 
    128 void    handle_core_note(Elf *, GElf_Ehdr *, GElf_Phdr *, char **); 
    129 int     handle_elf(char const *); 
    130 void    handle_phdr(Elf *, GElf_Ehdr *, GElf_Phdr *, uint32_t, 
    131             const char *); 
    132 void    show_version(void); 
    133 void    sysv_header(const char *, Elf_Arhdr *); 
    134 void    sysv_footer(void); 
    135 void    sysv_calc(Elf *, GElf_Ehdr *, GElf_Shdr *); 
    136 void    usage(void); 
    137 void    tbl_new(int); 
    138 void    tbl_print(const char *, int); 
    139 void    tbl_print_num(uint64_t, enum radix_style, int); 
    140 void    tbl_append(void); 
    141 void    tbl_flush(void); 
     119static void     berkeley_calc(GElf_Shdr *); 
     120static void     berkeley_footer(const char *, const char *, const char *); 
     121static void     berkeley_header(void); 
     122static void     berkeley_totals(void); 
     123static int      handle_core(char const *, Elf *elf, GElf_Ehdr *); 
     124static void     handle_core_note(Elf *, GElf_Ehdr *, GElf_Phdr *, char **); 
     125static int      handle_elf(char const *); 
     126static void     handle_phdr(Elf *, GElf_Ehdr *, GElf_Phdr *, uint32_t, 
     127                    const char *); 
     128static void     show_version(void); 
     129static void     sysv_header(const char *, Elf_Arhdr *); 
     130static void     sysv_footer(void); 
     131static void     sysv_calc(Elf *, GElf_Ehdr *, GElf_Shdr *); 
     132static void     usage(void); 
     133static void     tbl_new(int); 
     134static void     tbl_print(const char *, int); 
     135static void     tbl_print_num(uint64_t, enum radix_style, int); 
     136static void     tbl_append(void); 
     137static void     tbl_flush(void); 
    142138 
    143139/* 
     
    288284 * Parse individual note entries inside a PT_NOTE segment. 
    289285 */ 
    290 void 
     286static void 
    291287handle_core_note(Elf *elf, GElf_Ehdr *elfhdr, GElf_Phdr *phdr, 
    292288    char **cmd_line) 
     
    459455 * data, bss size is calculated for them. 
    460456 */ 
    461 void 
     457static void 
    462458handle_phdr(Elf *elf, GElf_Ehdr *elfhdr, GElf_Phdr *phdr, 
    463459    uint32_t idx, const char *name) 
     
    511507 * Given a core dump file, this function maps program headers to segments. 
    512508 */ 
    513 int 
     509static int 
    514510handle_core(char const *name, Elf *elf, GElf_Ehdr *elfhdr) 
    515511{ 
     
    595591 * or the size of the text, data, bss sections will be printed out. 
    596592 */ 
    597 int 
     593static int 
    598594handle_elf(char const *name) 
    599595{ 
     
    675671 * Sysv formatting helper functions. 
    676672 */ 
    677 void 
     673static void 
    678674sysv_header(const char *name, Elf_Arhdr *arhdr) 
    679675{ 
     
    691687} 
    692688 
    693 void 
     689static void 
    694690sysv_calc(Elf *elf, GElf_Ehdr *elfhdr, GElf_Shdr *shdr) 
    695691{ 
     
    709705} 
    710706 
    711 void 
     707static void 
    712708sysv_footer(void) 
    713709{ 
     
    721717 * berkeley style output formatting helper functions. 
    722718 */ 
    723 void 
     719static void 
    724720berkeley_header(void) 
    725721{ 
     
    743739} 
    744740 
    745 void 
     741static void 
    746742berkeley_calc(GElf_Shdr *shdr) 
    747743{ 
     
    762758} 
    763759 
    764 void 
     760static void 
    765761berkeley_totals(void) 
    766762{ 
     
    779775} 
    780776 
    781 void 
     777static void 
    782778berkeley_footer(const char *name, const char *ar_name, const char *msg) 
    783779{ 
     
    811807 
    812808 
    813 void 
     809static void 
    814810tbl_new(int col) 
    815811{ 
     
    827823} 
    828824 
    829 void 
     825static void 
    830826tbl_print(const char *s, int col) 
    831827{ 
     
    841837} 
    842838 
    843 void 
     839static void 
    844840tbl_print_num(uint64_t num, enum radix_style rad, int col) 
    845841{ 
     
    851847} 
    852848 
    853 void 
     849static void 
    854850tbl_append(void) 
    855851{ 
     
    866862} 
    867863 
    868 void 
     864static void 
    869865tbl_flush(void) 
    870866{ 
     
    922918  -x                 Equivalent to `--radix=16'.\n"; 
    923919 
    924 void 
     920static void 
    925921usage(void) 
    926922{ 
     
    929925} 
    930926 
    931 void 
     927static void 
    932928show_version(void) 
    933929{