mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 12:32:40 +03:00
De-inline a few functions which are large
...or not-so-large but nevertheless contain more than one function call, or contain loops, or contain if's and at least one function call, or contain largish objects on stack. In my experience, in those cases the code size growth is big enough to not inline stuff. I guess some of the really big functions are defined inline because they have, or had in the past, just one callsite. But for a few years gcc already does it automatically, no need to do it by hand and risk code size explosion when later during code evolution another callsite is created. This optimization by hand is simply no longer needed. Anyway, here is the code size difference: text data bss dec hex filename 572337 17944 177820 768101 bb865 mc.t5/.obj/src/mc 567697 17944 177820 763461 ba645 mc.t6/.obj/src/mc Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com> Signed-off-by: Sergei Trofimovich <slyfox@inbox.ru>
This commit is contained in:
parent
d534fdfa58
commit
e064bd60df
@ -49,7 +49,7 @@
|
||||
appended after each other and the last one is always the one found
|
||||
by book_mark_found() i.e. last in is the one seen */
|
||||
|
||||
static inline struct _book_mark *double_marks (WEdit * edit, struct _book_mark *p)
|
||||
static struct _book_mark *double_marks (WEdit * edit, struct _book_mark *p)
|
||||
{
|
||||
(void) edit;
|
||||
|
||||
|
@ -634,7 +634,7 @@ edit_save_position (WEdit *edit)
|
||||
}
|
||||
|
||||
/* Clean the WEdit stricture except the widget part */
|
||||
static inline void
|
||||
static void
|
||||
edit_purge_widget (WEdit *edit)
|
||||
{
|
||||
int len = sizeof (WEdit) - sizeof (Widget);
|
||||
@ -1030,7 +1030,7 @@ pop_action (WEdit * edit)
|
||||
}
|
||||
|
||||
/* is called whenever a modification is made by one of the four routines below */
|
||||
static inline void edit_modification (WEdit * edit)
|
||||
static void edit_modification (WEdit * edit)
|
||||
{
|
||||
edit->caches_valid = 0;
|
||||
edit->screen_modified = 1;
|
||||
|
@ -131,7 +131,7 @@ mc_defines_destroy (gpointer key, gpointer value, gpointer data)
|
||||
}
|
||||
|
||||
/* Completely destroys the defines tree */
|
||||
static inline void
|
||||
static void
|
||||
destroy_defines (GTree **defines)
|
||||
{
|
||||
g_tree_traverse (*defines, mc_defines_destroy, G_POST_ORDER, NULL);
|
||||
@ -292,7 +292,7 @@ compare_word_to_right (WEdit *edit, long i, const char *text,
|
||||
return i;
|
||||
}
|
||||
|
||||
static inline const char *xx_strchr (const unsigned char *s, int c)
|
||||
static const char *xx_strchr (const unsigned char *s, int c)
|
||||
{
|
||||
while (*s >= '\005' && *s != (unsigned char) c) {
|
||||
s++;
|
||||
@ -300,7 +300,7 @@ static inline const char *xx_strchr (const unsigned char *s, int c)
|
||||
return (const char *) s;
|
||||
}
|
||||
|
||||
static inline struct syntax_rule apply_rules_going_right (WEdit * edit, long i, struct syntax_rule rule)
|
||||
static struct syntax_rule apply_rules_going_right (WEdit * edit, long i, struct syntax_rule rule)
|
||||
{
|
||||
struct context_rule *r;
|
||||
int contextchanged = 0, c;
|
||||
|
@ -612,7 +612,7 @@ chown_advanced_done (void)
|
||||
}
|
||||
|
||||
#if 0
|
||||
static inline void do_chown (uid_t u, gid_t g)
|
||||
static void do_chown (uid_t u, gid_t g)
|
||||
{
|
||||
chown (current_panel->dir.list[current_file].fname, u, g);
|
||||
file_mark (current_panel, current_file, 0);
|
||||
|
@ -215,7 +215,7 @@ chown_done (void)
|
||||
repaint_screen ();
|
||||
}
|
||||
|
||||
static inline void
|
||||
static void
|
||||
do_chown (uid_t u, gid_t g)
|
||||
{
|
||||
if (mc_chown (current_panel->dir.list [current_file].fname, u, g) == -1)
|
||||
|
@ -587,7 +587,7 @@ void dlg_stop (Dlg_head *h)
|
||||
h->running = 0;
|
||||
}
|
||||
|
||||
static inline void
|
||||
static void
|
||||
dialog_handle_key (Dlg_head *h, int d_key)
|
||||
{
|
||||
if (is_abort_char (d_key)) {
|
||||
@ -732,7 +732,7 @@ dlg_key_event (Dlg_head *h, int d_key)
|
||||
(*h->callback) (h, DLG_POST_KEY, d_key);
|
||||
}
|
||||
|
||||
static inline int
|
||||
static int
|
||||
dlg_mouse_event (Dlg_head * h, Gpm_Event * event)
|
||||
{
|
||||
Widget *item;
|
||||
@ -826,7 +826,7 @@ void dlg_process_event (Dlg_head *h, int key, Gpm_Event *event)
|
||||
dlg_key_event (h, key);
|
||||
}
|
||||
|
||||
static inline void
|
||||
static void
|
||||
frontend_run_dlg (Dlg_head *h)
|
||||
{
|
||||
int d_key;
|
||||
|
@ -186,7 +186,7 @@ status_update (const char *text)
|
||||
label_set_text (status_label, text);
|
||||
}
|
||||
|
||||
static inline void
|
||||
static void
|
||||
found_num_update (void)
|
||||
{
|
||||
char buffer [BUF_TINY];
|
||||
|
@ -175,7 +175,7 @@ hotlist_refresh (Dlg_head * dlg)
|
||||
}
|
||||
|
||||
/* If current->data is 0, then we are dealing with a VFS pathname */
|
||||
static inline void
|
||||
static void
|
||||
update_path_name (void)
|
||||
{
|
||||
const char *text = "";
|
||||
|
@ -125,7 +125,7 @@ static void menubar_paint_idx (WMenu *menubar, int idx, int color)
|
||||
}
|
||||
}
|
||||
|
||||
static inline void menubar_draw_drop (WMenu *menubar)
|
||||
static void menubar_draw_drop (WMenu *menubar)
|
||||
{
|
||||
const int count = menubar->menu [menubar->selected]->count;
|
||||
int column = menubar->menu [menubar->selected]->start_x - 1;
|
||||
@ -190,10 +190,10 @@ static void menubar_draw (WMenu *menubar)
|
||||
menubar-> menu[menubar->selected]->start_x);
|
||||
}
|
||||
|
||||
static inline void menubar_remove (WMenu *menubar)
|
||||
static void menubar_remove (WMenu *menubar)
|
||||
{
|
||||
menubar->subsel = 0;
|
||||
if (menubar->dropped){
|
||||
if (menubar->dropped) {
|
||||
menubar->dropped = 0;
|
||||
do_refresh ();
|
||||
menubar->dropped = 1;
|
||||
|
@ -177,7 +177,7 @@ string_file_name (file_entry *fe, int len)
|
||||
return buffer;
|
||||
}
|
||||
|
||||
static inline unsigned int ilog10(dev_t n)
|
||||
static unsigned int ilog10(dev_t n)
|
||||
{
|
||||
unsigned int digits = 0;
|
||||
do {
|
||||
@ -968,7 +968,7 @@ do_select (WPanel *panel, int i)
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
static void
|
||||
do_try_to_select (WPanel *panel, const char *name)
|
||||
{
|
||||
int i;
|
||||
@ -2374,7 +2374,7 @@ static const panel_key_map panel_keymap [] = {
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static inline cb_ret_t
|
||||
static cb_ret_t
|
||||
panel_key (WPanel *panel, int key)
|
||||
{
|
||||
int i;
|
||||
@ -2521,7 +2521,7 @@ mouse_set_mark (WPanel *panel)
|
||||
do_mark_file (panel, 0);
|
||||
}
|
||||
|
||||
static inline int
|
||||
static int
|
||||
mark_if_marking (WPanel *panel, Gpm_Event *event)
|
||||
{
|
||||
if (event->buttons & GPM_B_RIGHT){
|
||||
|
@ -907,7 +907,7 @@ static const tree_key_map tree_keymap [] = {
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static inline cb_ret_t
|
||||
static cb_ret_t
|
||||
tree_key (WTree *tree, int key)
|
||||
{
|
||||
int i;
|
||||
|
@ -485,7 +485,7 @@ static Window x11_window;
|
||||
|
||||
/*** file scope functions **********************************************/
|
||||
|
||||
inline static int
|
||||
static int
|
||||
add_selects (fd_set *select_set)
|
||||
{
|
||||
int top_fd = 0;
|
||||
|
@ -233,7 +233,7 @@ mcview_set_byte (mcview_t * view, off_t offset, byte b)
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
/*static inline*/
|
||||
/*static*/
|
||||
void
|
||||
mcview_file_load_data (mcview_t * view, off_t byte_index)
|
||||
{
|
||||
|
@ -131,7 +131,7 @@ vfs_new_handle (struct vfs_class *vclass, void *fsinfo)
|
||||
}
|
||||
|
||||
/** Find VFS class by file handle */
|
||||
static inline struct vfs_class *
|
||||
static struct vfs_class *
|
||||
vfs_op (int handle)
|
||||
{
|
||||
struct vfs_openfile *h;
|
||||
@ -151,7 +151,7 @@ vfs_op (int handle)
|
||||
}
|
||||
|
||||
/** Find private file data by file handle */
|
||||
static inline void *
|
||||
static void *
|
||||
vfs_info (int handle)
|
||||
{
|
||||
struct vfs_openfile *h;
|
||||
@ -171,7 +171,7 @@ vfs_info (int handle)
|
||||
}
|
||||
|
||||
/** Free open file data for given file handle */
|
||||
static inline void
|
||||
static void
|
||||
vfs_free_handle (int handle)
|
||||
{
|
||||
if (handle < VFS_FIRST_HANDLE ||
|
||||
@ -253,7 +253,7 @@ vfs_strip_suffix_from_filename (const char *filename)
|
||||
return p;
|
||||
}
|
||||
|
||||
static inline int
|
||||
static int
|
||||
path_magic (const char *path)
|
||||
{
|
||||
struct stat buf;
|
||||
|
Loading…
Reference in New Issue
Block a user