more style nits

This commit is contained in:
okan 2014-09-07 19:27:30 +00:00
parent be091b3523
commit 3d12b6d1d9
8 changed files with 67 additions and 67 deletions

View File

@ -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

View File

@ -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

20
conf.c
View File

@ -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

26
menu.c
View File

@ -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

View File

@ -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

View File

@ -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);
}

View File

@ -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);
}

18
xutil.c
View File

@ -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