diff --git a/src/config.c b/src/config.c index 7c7eb22..b329346 100644 --- a/src/config.c +++ b/src/config.c @@ -126,9 +126,10 @@ name_to_uint_t mouse_button_list[] = {"3", Button3 }, {"4", Button4 }, {"5", Button5 }, + {NULL, NoSymbol} }; -void +static void mouse_section(MouseBinding mb[], struct conf_sec **sec) { int n; @@ -143,7 +144,7 @@ mouse_section(MouseBinding mb[], struct conf_sec **sec) } } -void +static void conf_misc_section(void) { int pad = 12; @@ -180,7 +181,7 @@ conf_misc_section(void) return; } -void +static void conf_bar_section(void) { struct conf_sec *bar, **mouse, *selbar, *systray; @@ -238,7 +239,7 @@ conf_bar_section(void) return; } -void +static void conf_root_section(void) { struct conf_sec *root, **mouse; @@ -260,7 +261,7 @@ conf_root_section(void) return; } -void +static void conf_client_section(void) { int i, j; @@ -383,7 +384,7 @@ conf_client_section(void) return; } -void +static void conf_layout_section(void) { int i; @@ -461,7 +462,7 @@ conf_layout_section(void) return; } -void +static void conf_tag_section(void) { int i, j, k, l = 0, m, n, sc, count, bar_pos; @@ -613,7 +614,7 @@ conf_tag_section(void) return; } -void +static void conf_rule_section(void) { int i; @@ -644,7 +645,7 @@ conf_rule_section(void) return; } -void +static void conf_menu_section(void) { char *tmp2; @@ -705,7 +706,7 @@ conf_menu_section(void) return; } -void +static void conf_launcher_section(void) { int i; @@ -731,7 +732,7 @@ conf_launcher_section(void) return; } -void +static void conf_keybind_section(void) { int i; diff --git a/src/draw.c b/src/draw.c index 4fa3b3f..8cf8a5d 100644 --- a/src/draw.c +++ b/src/draw.c @@ -100,7 +100,7 @@ draw_image_ofset_text(Drawable d, int x, int y, char* fg, char *str, int x_image if(strstr(ostr, "i[")) strncpy(str, ostr, textlen); - IFREE(ostr); + free(ostr); #endif /* HAVE_IMLIB */ return; @@ -226,7 +226,7 @@ textw(char *text) if(strstr(ostr, "i[")) strncpy(text, ostr, textlen); - IFREE(ostr); + free(ostr); #endif /* HAVE_IMLIB */ return gl.width + font->descent; diff --git a/src/getinfo.c b/src/getinfo.c index b4e2928..46d3ce8 100644 --- a/src/getinfo.c +++ b/src/getinfo.c @@ -42,7 +42,7 @@ uchar *ret; /** Get information about tag (current, list, names) */ -void +static void getinfo_tag(void) { int tag = 0; @@ -74,15 +74,15 @@ getinfo_tag(void) printf("Current tag: %d - %s\n", tag, tag_name); printf("Tag list: %s\n", tag_list); - IFREE(tag_name); - IFREE(tag_list); + free(tag_name); + free(tag_list); return; } /** Get information about screens */ -void +static void getinfo_screen(void) { int screen = 1; @@ -108,7 +108,7 @@ getinfo_screen(void) /** Get current layout name */ -void +static void getinfo_layout(void) { char *layout = NULL; @@ -122,14 +122,14 @@ getinfo_layout(void) printf("Current layout: %s\n", layout); - IFREE(layout); + free(layout); return; } /** Get information about current mwfact */ -void +static void getinfo_mwfact(void) { char *mwfact = NULL; @@ -143,14 +143,14 @@ getinfo_mwfact(void) printf("Current mwfact: %s\n", mwfact); - IFREE(mwfact); + free(mwfact); return; } /** Get information about current nmaster */ -void +static void getinfo_nmaster(void) { int nmaster = 1; diff --git a/src/infobar.c b/src/infobar.c index 390eb39..0928953 100644 --- a/src/infobar.c +++ b/src/infobar.c @@ -209,7 +209,7 @@ infobar_draw_selbar(int sc) barwin_refresh(infobar[sc].selbar); - IFREE(str); + free(str); return; } diff --git a/src/init.c b/src/init.c index 21b01e0..436f1d0 100644 --- a/src/init.c +++ b/src/init.c @@ -55,32 +55,9 @@ const func_name_list_t layout_list[] = { NULL, NULL } }; -/** Init WMFS -*/ -void -init(void) -{ - /* First init */ - ewmh_init_hints(); - init_conf(); - init_gc(); - init_font(); - init_cursor(); - init_key(); - init_root(); - screen_init_geo(); - infobar_init(); - systray_acquire(); - init_status(); - ewmh_update_current_tag_prop(); - grabkeys(); - - return; -} - /** Init the font */ -void +static void init_font(void) { font = XftFontOpenName(dpy, SCREEN, conf.font); @@ -100,7 +77,7 @@ init_font(void) /** Init the graphic context */ -void +static void init_gc(void) { XGCValues gcv; @@ -127,7 +104,7 @@ init_gc(void) /** Init WMFS cursor */ -void +static void init_cursor(void) { cursor[CurNormal] = XCreateFontCursor(dpy, XC_left_ptr); @@ -141,7 +118,7 @@ init_cursor(void) /** Init key modifier */ -void +static void init_key(void) { int i, j; @@ -160,7 +137,7 @@ init_key(void) /** Init root Window */ -void +static void init_root(void) { XSetWindowAttributes at; @@ -183,7 +160,7 @@ init_root(void) /** Init statustext shell script */ -void +static void init_status(void) { struct stat st; @@ -218,3 +195,26 @@ init_status(void) return; } +/** Init WMFS +*/ +void +init(void) +{ + /* First init */ + ewmh_init_hints(); + init_conf(); + init_gc(); + init_font(); + init_cursor(); + init_key(); + init_root(); + screen_init_geo(); + infobar_init(); + systray_acquire(); + init_status(); + ewmh_update_current_tag_prop(); + grabkeys(); + + return; +} + diff --git a/src/launcher.c b/src/launcher.c index 6690080..3aa32f3 100644 --- a/src/launcher.c +++ b/src/launcher.c @@ -370,7 +370,7 @@ complete_on_files(char *start, size_t hits) else warn("%s", filepath); - IFREE(filepath); + free(filepath); break; } @@ -378,8 +378,8 @@ complete_on_files(char *start, size_t hits) closedir(dir); } - IFREE(dirname); - IFREE(path); + free(dirname); + free(path); return ret; } diff --git a/src/layout.c b/src/layout.c index fcd92ac..f9703b6 100644 --- a/src/layout.c +++ b/src/layout.c @@ -443,8 +443,7 @@ mirror(int screen, Bool horizontal) int pa, imp; Bool isp = 0; - memset(&nextg[0], 0, sizeof(nextg[0])); - memset(&nextg[1], 0, sizeof(nextg[2])); + memset(nextg, 0, sizeof(nextg)); for(n = 0, c = tiled_client(screen, clients); c; c = tiled_client(screen, c->next), ++n); CHECK(n); diff --git a/src/menu.c b/src/menu.c index c90cedc..c8c8160 100644 --- a/src/menu.c +++ b/src/menu.c @@ -345,7 +345,7 @@ uicb_menu(uicb_t cmd) void menu_clear(Menu *menu) { - IFREE(menu->item); + free(menu->item); menu->nitem = 0; return; diff --git a/src/parse.c b/src/parse.c index f649dac..289fe91 100644 --- a/src/parse.c +++ b/src/parse.c @@ -307,6 +307,7 @@ parse_keywords(const char *filename) free(buf); free(bufname); + close(fd); warnx("%s read", file->name); return (error ? NULL: head); @@ -388,8 +389,7 @@ include(struct keyword *head) static void * free_opt(struct conf_opt *o) { - if (o) - free(o); + free(o); return NULL; } @@ -563,8 +563,7 @@ free_conf(void) while (kw) { nkw = kw->next; - if (kw->name) - free(kw->name); + free(kw->name); for (i = 0; i < nf; i++) { if (f[i] == kw->file) { diff --git a/src/systray.c b/src/systray.c index abc8e53..832b209 100644 --- a/src/systray.c +++ b/src/systray.c @@ -118,7 +118,7 @@ systray_del(Systray *s) for(ss = &trayicons; *ss && *ss != s; ss = &(*ss)->next); *ss = s->next; - IFREE(s); + free(s); return; } @@ -162,7 +162,7 @@ systray_freeicons(void) { XUnmapWindow(dpy, i->win); XReparentWindow(dpy, i->win, ROOT, 0, 0); - IFREE(i); + free(i); } XSetSelectionOwner(dpy, net_atom[net_system_tray_s], None, CurrentTime); diff --git a/src/wmfs.c b/src/wmfs.c index 00f3878..632c7e5 100644 --- a/src/wmfs.c +++ b/src/wmfs.c @@ -92,8 +92,8 @@ quit(void) XReparentWindow(dpy, c->win, ROOT, c->geo.x, c->geo.y); } - IFREE(tags); - IFREE(seltag); + free(tags); + free(seltag); systray_freeicons(); @@ -103,31 +103,31 @@ quit(void) XFreeGC(dpy, gc_stipple); infobar_destroy(); - IFREE(sgeo); - IFREE(spgeo); - IFREE(infobar); - IFREE(keys); - IFREE(net_atom); + free(sgeo); + free(spgeo); + free(infobar); + free(keys); + free(net_atom); /* Clean conf alloced thing */ - IFREE(menulayout.item); + free(menulayout.item); if(conf.menu) { len = LEN(conf.menu); for(i = 0; i < len; ++i) - IFREE(conf.menu[i].item); - IFREE(conf.menu); + free(conf.menu[i].item); + free(conf.menu); } - IFREE(conf.launcher); - IFREE(conf.rule); + free(conf.launcher); + free(conf.rule); - IFREE(conf.bars.mouse); - IFREE(conf.selbar.mouse); - IFREE(conf.titlebar.button); - IFREE(conf.client.mouse); - IFREE(conf.root.mouse); + free(conf.bars.mouse); + free(conf.selbar.mouse); + free(conf.titlebar.button); + free(conf.client.mouse); + free(conf.root.mouse); free_conf(); diff --git a/src/wmfs.h b/src/wmfs.h index 843d12e..844935a 100644 --- a/src/wmfs.h +++ b/src/wmfs.h @@ -108,7 +108,6 @@ #define FRAMEH(h) ((h) + (BORDH + TBARH)) #define ROUND(x) (float)((x > 0) ? x + (float)0.5 : x - (float)0.5) #define CHECK(x) if(!(x)) return -#define IFREE(x) if(x) free(x) #define LEN(x) (sizeof(x) / sizeof((x)[0])) #define MAXCLIST (64) @@ -400,20 +399,8 @@ Bool uicb_checklayout(uicb_t); /* init.c */ void init(void); -void init_root(void); -void init_font(void); -void init_gc(void); -void init_cursor(void); -void init_key(void); -void init_geometry(void); -void init_status(void); /* getinfo.c */ -void getinfo_tag(void); -void getinfo_screen(void); -void getinfo_layout(void); -void getinfo_mwfact(void); -void getinfo_nmaster(void); void getinfo(char *info); /* viwmfs.c */