From 3d12b6d1d940d40c1298ae03e519c8ac4a9a1407 Mon Sep 17 00:00:00 2001 From: okan Date: Sun, 7 Sep 2014 19:27:30 +0000 Subject: [PATCH] more style nits --- calmwm.c | 6 +++--- client.c | 34 +++++++++++++++++----------------- conf.c | 20 ++++++++++---------- menu.c | 26 +++++++++++++------------- screen.c | 10 +++++----- search.c | 12 ++++++------ xmalloc.c | 8 ++++---- xutil.c | 18 +++++++++--------- 8 files changed, 67 insertions(+), 67 deletions(-) diff --git a/calmwm.c b/calmwm.c index 90844a5..06029a2 100644 --- a/calmwm.c +++ b/calmwm.c @@ -120,7 +120,7 @@ main(int argc, char **argv) if (cwm_status == CWM_RESTART) x_restart(cwm_argv); - return (0); + return(0); } static void @@ -185,7 +185,7 @@ x_wmerrorhandler(Display *dpy, XErrorEvent *e) { errx(1, "root window unavailable - perhaps another wm is running?"); - return (0); + return(0); } static int @@ -201,7 +201,7 @@ x_errorhandler(Display *dpy, XErrorEvent *e) warnx("%s(0x%x): %s", req, (unsigned int)e->resourceid, msg); #endif - return (0); + return(0); } static void diff --git a/client.c b/client.c index a75b3bc..54c8ecb 100644 --- a/client.c +++ b/client.c @@ -47,11 +47,11 @@ client_find(Window win) { struct client_ctx *cc; - TAILQ_FOREACH(cc, &Clientq, entry) + TAILQ_FOREACH(cc, &Clientq, entry) { if (cc->win == win) - return (cc); - - return (NULL); + return(cc); + } + return(NULL); } struct client_ctx * @@ -63,16 +63,16 @@ client_init(Window win, struct screen_ctx *sc) int mapped; if (win == None) - return (NULL); + return(NULL); if (!XGetWindowAttributes(X_Dpy, win, &wattr)) - return (NULL); + return(NULL); if (sc == NULL) { sc = screen_find(wattr.root); mapped = 1; } else { if (wattr.override_redirect || wattr.map_state != IsViewable) - return (NULL); + return(NULL); mapped = wattr.map_state != IsUnmapped; } @@ -138,7 +138,7 @@ client_init(Window win, struct screen_ctx *sc) XSync(X_Dpy, False); XUngrabServer(X_Dpy); - return (cc); + return(cc); } void @@ -226,7 +226,7 @@ client_none(struct screen_ctx *sc) struct client_ctx * client_current(void) { - return (curcc); + return(curcc); } void @@ -696,7 +696,7 @@ client_mrunext(struct client_ctx *cc) struct screen_ctx *sc = cc->sc; struct client_ctx *ccc; - return ((ccc = TAILQ_NEXT(cc, mru_entry)) != NULL ? + return((ccc = TAILQ_NEXT(cc, mru_entry)) != NULL ? ccc : TAILQ_FIRST(&sc->mruq)); } @@ -706,7 +706,7 @@ client_mruprev(struct client_ctx *cc) struct screen_ctx *sc = cc->sc; struct client_ctx *ccc; - return ((ccc = TAILQ_PREV(cc, cycle_entry_q, mru_entry)) != NULL ? + return((ccc = TAILQ_PREV(cc, cycle_entry_q, mru_entry)) != NULL ? ccc : TAILQ_LAST(&sc->mruq, cycle_entry_q)); } @@ -896,7 +896,7 @@ client_transient(struct client_ctx *cc) static int client_inbound(struct client_ctx *cc, int x, int y) { - return (x < cc->geom.w && x >= 0 && + return(x < cc->geom.w && x >= 0 && y < cc->geom.h && y >= 0); } @@ -916,15 +916,15 @@ client_snapcalc(int n0, int n1, int e0, int e1, int snapdist) /* possible to snap in both directions */ if (s0 != 0 && s1 != 0) if (abs(s0) < abs(s1)) - return (s0); + return(s0); else - return (s1); + return(s1); else if (s0 != 0) - return (s0); + return(s0); else if (s1 != 0) - return (s1); + return(s1); else - return (0); + return(0); } void diff --git a/conf.c b/conf.c index bc2a4ed..e33c81f 100644 --- a/conf.c +++ b/conf.c @@ -475,14 +475,14 @@ conf_bind_getmask(const char *name, unsigned int *mask) *mask = 0; if ((dash = strchr(name, '-')) == NULL) - return (name); + return(name); for (i = 0; i < nitems(bind_mods); i++) { if ((ch = strchr(name, bind_mods[i].ch)) != NULL && ch < dash) *mask |= bind_mods[i].mask; } /* Skip past modifiers. */ - return (dash + 1); + return(dash + 1); } int @@ -500,7 +500,7 @@ conf_bind_kbd(struct conf *c, const char *bind, const char *cmd) if (kb->press.keysym == NoSymbol) { warnx("unknown symbol: %s", key); free(kb); - return (0); + return(0); } /* We now have the correct binding, remove duplicates. */ @@ -508,7 +508,7 @@ conf_bind_kbd(struct conf *c, const char *bind, const char *cmd) if (strcmp("unmap", cmd) == 0) { free(kb); - return (1); + return(1); } for (i = 0; i < nitems(name_to_func); i++) { @@ -520,7 +520,7 @@ conf_bind_kbd(struct conf *c, const char *bind, const char *cmd) kb->argument = name_to_func[i].argument; kb->argtype |= ARG_INT; TAILQ_INSERT_TAIL(&c->keybindingq, kb, entry); - return (1); + return(1); } kb->callback = kbfunc_cmdexec; @@ -528,7 +528,7 @@ conf_bind_kbd(struct conf *c, const char *bind, const char *cmd) kb->argument.c = xstrdup(cmd); kb->argtype |= ARG_CHAR; TAILQ_INSERT_TAIL(&c->keybindingq, kb, entry); - return (1); + return(1); } static void @@ -564,7 +564,7 @@ conf_bind_mouse(struct conf *c, const char *bind, const char *cmd) if (errstr) { warnx("button number is %s: %s", errstr, button); free(mb); - return (0); + return(0); } /* We now have the correct binding, remove duplicates. */ @@ -572,7 +572,7 @@ conf_bind_mouse(struct conf *c, const char *bind, const char *cmd) if (strcmp("unmap", cmd) == 0) { free(mb); - return (1); + return(1); } for (i = 0; i < nitems(name_to_func); i++) { @@ -583,10 +583,10 @@ conf_bind_mouse(struct conf *c, const char *bind, const char *cmd) mb->flags = name_to_func[i].flags; mb->argument = name_to_func[i].argument; TAILQ_INSERT_TAIL(&c->mousebindingq, mb, entry); - return (1); + return(1); } - return (0); + return(0); } static void diff --git a/menu.c b/menu.c index 2b28c14..cd84602 100644 --- a/menu.c +++ b/menu.c @@ -126,7 +126,7 @@ menu_filter(struct screen_ctx *sc, struct menu_q *menuq, const char *prompt, if (xu_ptr_grab(sc->menuwin, MENUGRABMASK, Conf.cursor[CF_QUESTION]) < 0) { XUnmapWindow(X_Dpy, sc->menuwin); - return (NULL); + return(NULL); } XGetInputFocus(X_Dpy, &focuswin, &focusrevert); @@ -180,7 +180,7 @@ out: XUnmapWindow(X_Dpy, sc->menuwin); XUngrabKeyboard(X_Dpy, CurrentTime); - return (mi); + return(mi); } static struct menu * @@ -210,7 +210,7 @@ menu_complete_path(struct menu_ctx *mc) else if (!mr->abort) strlcpy(mr->text, mc->searchstr, sizeof(mr->text)); free(path); - return (mr); + return(mr); } static struct menu * @@ -225,7 +225,7 @@ menu_handle_key(XEvent *e, struct menu_ctx *mc, struct menu_q *menuq, wchar_t wc; if (menu_keycode(&e->xkey, &ctl, chr) < 0) - return (NULL); + return(NULL); switch (ctl) { case CTL_ERASEONE: @@ -266,7 +266,7 @@ menu_handle_key(XEvent *e, struct menu_ctx *mc, struct menu_q *menuq, mi->dummy = 1; } mi->abort = 0; - return (mi); + return(mi); case CTL_WIPE: mc->searchstr[0] = '\0'; mc->changed = 1; @@ -281,7 +281,7 @@ menu_handle_key(XEvent *e, struct menu_ctx *mc, struct menu_q *menuq, if ((mc->flags & CWM_MENU_FILE) && (strncmp(mc->searchstr, mi->text, strlen(mi->text))) == 0) - return (menu_complete_path(mc)); + return(menu_complete_path(mc)); /* * Put common prefix of the results into searchstr @@ -306,7 +306,7 @@ menu_handle_key(XEvent *e, struct menu_ctx *mc, struct menu_q *menuq, mi->text[0] = '\0'; mi->dummy = 1; mi->abort = 1; - return (mi); + return(mi); default: break; } @@ -329,7 +329,7 @@ menu_handle_key(XEvent *e, struct menu_ctx *mc, struct menu_q *menuq, mc->listing = 0; } - return (NULL); + return(NULL); } static void @@ -497,7 +497,7 @@ menu_handle_release(XEvent *e, struct menu_ctx *mc, struct menu_q *resultq) mi->text[0] = '\0'; mi->dummy = 1; } - return (mi); + return(mi); } static int @@ -517,7 +517,7 @@ menu_calc_entry(struct menu_ctx *mc, int x, int y) if (mc->hasprompt && entry == 0) entry = -1; - return (entry); + return(entry); } static int @@ -597,12 +597,12 @@ menu_keycode(XKeyEvent *ev, enum ctltype *ctl, char *chr) } if (*ctl != CTL_NONE) - return (0); + return(0); if (XLookupString(ev, chr, 32, &ks, NULL) < 0) - return (-1); + return(-1); - return (0); + return(0); } void diff --git a/screen.c b/screen.c index a81f0b6..1706f5b 100644 --- a/screen.c +++ b/screen.c @@ -83,12 +83,12 @@ screen_find(Window win) { struct screen_ctx *sc; - TAILQ_FOREACH(sc, &Screenq, entry) + TAILQ_FOREACH(sc, &Screenq, entry) { if (sc->rootwin == win) - return (sc); - + return(sc); + } /* XXX FAIL HERE */ - return (TAILQ_FIRST(&Screenq)); + return(TAILQ_FIRST(&Screenq)); } void @@ -133,7 +133,7 @@ screen_find_xinerama(struct screen_ctx *sc, int x, int y, int flags) geom.w -= (sc->gap.left + sc->gap.right); geom.h -= (sc->gap.top + sc->gap.bottom); } - return (geom); + return(geom); } void diff --git a/search.c b/search.c index 4b4f457..adb2f60 100644 --- a/search.c +++ b/search.c @@ -194,13 +194,13 @@ search_match_path(struct menu_q *menuq, struct menu_q *resultq, char *search, in static void search_match_path_exec(struct menu_q *menuq, struct menu_q *resultq, char *search) { - return (search_match_path(menuq, resultq, search, PATH_EXEC)); + return(search_match_path(menuq, resultq, search, PATH_EXEC)); } void search_match_path_any(struct menu_q *menuq, struct menu_q *resultq, char *search) { - return (search_match_path(menuq, resultq, search, PATH_ANY)); + return(search_match_path(menuq, resultq, search, PATH_ANY)); } void @@ -254,13 +254,13 @@ strsubmatch(char *sub, char *str, int zeroidx) unsigned int n, flen; if (sub == NULL || str == NULL) - return (0); + return(0); len = strlen(str); sublen = strlen(sub); if (sublen > len) - return (0); + return(0); if (!zeroidx) flen = len - sublen; @@ -269,7 +269,7 @@ strsubmatch(char *sub, char *str, int zeroidx) for (n = 0; n <= flen; n++) if (strncasecmp(sub, str + n, sublen) == 0) - return (1); + return(1); - return (0); + return(0); } diff --git a/xmalloc.c b/xmalloc.c index 0f1d6f3..6963c96 100644 --- a/xmalloc.c +++ b/xmalloc.c @@ -42,7 +42,7 @@ xmalloc(size_t siz) if ((p = malloc(siz)) == NULL) err(1, "malloc"); - return (p); + return(p); } void * @@ -57,7 +57,7 @@ xcalloc(size_t no, size_t siz) if ((p = calloc(no, siz)) == NULL) err(1, "calloc"); - return (p); + return(p); } char * @@ -68,7 +68,7 @@ xstrdup(const char *str) if ((p = strdup(str)) == NULL) err(1, "strdup"); - return (p); + return(p); } int @@ -84,5 +84,5 @@ xasprintf(char **ret, const char *fmt, ...) if (i < 0 || *ret == NULL) err(1, "asprintf"); - return (i); + return(i); } diff --git a/xutil.c b/xutil.c index 8c02456..b490652 100644 --- a/xutil.c +++ b/xutil.c @@ -74,7 +74,7 @@ xu_key_ungrab(Window win) int xu_ptr_grab(Window win, unsigned int mask, Cursor curs) { - return (XGrabPointer(X_Dpy, win, False, mask, + return(XGrabPointer(X_Dpy, win, False, mask, GrabModeAsync, GrabModeAsync, None, curs, CurrentTime) == GrabSuccess ? 0 : -1); } @@ -82,7 +82,7 @@ xu_ptr_grab(Window win, unsigned int mask, Cursor curs) int xu_ptr_regrab(unsigned int mask, Cursor curs) { - return (XChangeActivePointerGrab(X_Dpy, mask, + return(XChangeActivePointerGrab(X_Dpy, mask, curs, CurrentTime) == GrabSuccess ? 0 : -1); } @@ -117,12 +117,12 @@ xu_getprop(Window win, Atom atm, Atom type, long len, unsigned char **p) if (XGetWindowProperty(X_Dpy, win, atm, 0L, len, False, type, &realtype, &format, &n, &extra, p) != Success || *p == NULL) - return (-1); + return(-1); if (n == 0) XFree(*p); - return (n); + return(n); } int @@ -135,7 +135,7 @@ xu_getstrprop(Window win, Atom atm, char **text) { XGetTextProperty(X_Dpy, win, &prop, atm); if (!prop.nitems) - return (0); + return(0); if (Xutf8TextPropertyToTextList(X_Dpy, &prop, &list, &nitems) == Success && nitems > 0 && *list) { @@ -154,7 +154,7 @@ xu_getstrprop(Window win, Atom atm, char **text) { XFree(prop.value); - return (nitems); + return(nitems); } /* Root Window Properties */ @@ -351,13 +351,13 @@ xu_ewmh_get_net_wm_state(struct client_ctx *cc, int *n) if ((*n = xu_getprop(cc->win, ewmh[_NET_WM_STATE], XA_ATOM, 64L, (unsigned char **)&p)) <= 0) - return (NULL); + return(NULL); state = xcalloc(*n, sizeof(Atom)); (void)memcpy(state, p, *n * sizeof(Atom)); XFree((char *)p); - return (state); + return(state); } void @@ -483,7 +483,7 @@ xu_xft_width(XftFont *xftfont, const char *text, int len) XftTextExtentsUtf8(X_Dpy, xftfont, (const FcChar8*)text, len, &extents); - return (extents.xOff); + return(extents.xOff); } void