diff options
author | Okan Demirmen <okan@cvs.openbsd.org> | 2011-07-25 15:10:25 +0000 |
---|---|---|
committer | Okan Demirmen <okan@cvs.openbsd.org> | 2011-07-25 15:10:25 +0000 |
commit | a56f38b477f41c0cd07172690e68a3fae13ba1b1 (patch) | |
tree | f7c4665b6b11e431f1f20f0d7d9e5c93cf34b2da /app | |
parent | 89a5fb36a75d68721ebff0415975c16f41422a2a (diff) |
We are inconsistent when it comes to function returns, so just go all
the way with the cwm specific parts.
ok oga@
Diffstat (limited to 'app')
-rw-r--r-- | app/cwm/calmwm.c | 9 | ||||
-rw-r--r-- | app/cwm/conf.c | 21 | ||||
-rw-r--r-- | app/cwm/group.c | 8 | ||||
-rw-r--r-- | app/cwm/kbfunc.c | 19 | ||||
-rw-r--r-- | app/cwm/menu.c | 20 | ||||
-rw-r--r-- | app/cwm/mousefunc.c | 8 | ||||
-rw-r--r-- | app/cwm/parse.y | 10 | ||||
-rw-r--r-- | app/cwm/search.c | 11 | ||||
-rw-r--r-- | app/cwm/util.c | 6 | ||||
-rw-r--r-- | app/cwm/xutil.c | 4 |
10 files changed, 60 insertions, 56 deletions
diff --git a/app/cwm/calmwm.c b/app/cwm/calmwm.c index 5fb67f643..50ef2f405 100644 --- a/app/cwm/calmwm.c +++ b/app/cwm/calmwm.c @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: calmwm.c,v 1.57 2011/07/23 13:09:11 okan Exp $ + * $OpenBSD: calmwm.c,v 1.58 2011/07/25 15:10:24 okan Exp $ */ #include <sys/param.h> @@ -194,7 +194,7 @@ x_setupscreen(struct screen_ctx *sc, u_int which) if (winattr.override_redirect || winattr.map_state != IsViewable) continue; - client_new(wins[i], sc, winattr.map_state != IsUnmapped); + (void)client_new(wins[i], sc, winattr.map_state != IsUnmapped); } XFree(wins); @@ -229,7 +229,7 @@ x_errorhandler(Display *dpy, XErrorEvent *e) char msg[80], number[80], req[80]; XGetErrorText(X_Dpy, e->error_code, msg, sizeof(msg)); - snprintf(number, sizeof(number), "%d", e->request_code); + (void)snprintf(number, sizeof(number), "%d", e->request_code); XGetErrorDatabaseText(X_Dpy, "XRequest", number, "<unknown>", req, sizeof(req)); @@ -258,6 +258,7 @@ usage(void) { extern char *__progname; - fprintf(stderr, "usage: %s [-c file] [-d display]\n", __progname); + (void)fprintf(stderr, "usage: %s [-c file] [-d display]\n", + __progname); exit(1); } diff --git a/app/cwm/conf.c b/app/cwm/conf.c index 1066c4996..63dae3049 100644 --- a/app/cwm/conf.c +++ b/app/cwm/conf.c @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: conf.c,v 1.87 2011/07/14 11:39:53 okan Exp $ + * $OpenBSD: conf.c,v 1.88 2011/07/25 15:10:24 okan Exp $ */ #include <sys/param.h> @@ -48,14 +48,14 @@ conf_cmd_add(struct conf *c, char *image, char *label, int flags) /* "term" and "lock" have special meanings. */ if (strcmp(label, "term") == 0) - strlcpy(c->termpath, image, sizeof(c->termpath)); + (void)strlcpy(c->termpath, image, sizeof(c->termpath)); else if (strcmp(label, "lock") == 0) - strlcpy(c->lockpath, image, sizeof(c->lockpath)); + (void)strlcpy(c->lockpath, image, sizeof(c->lockpath)); else { struct cmd *cmd = xmalloc(sizeof(*cmd)); cmd->flags = flags; - strlcpy(cmd->image, image, sizeof(cmd->image)); - strlcpy(cmd->label, label, sizeof(cmd->label)); + (void)strlcpy(cmd->image, image, sizeof(cmd->image)); + (void)strlcpy(cmd->label, label, sizeof(cmd->label)); TAILQ_INSERT_TAIL(&c->cmdq, cmd, entry); } } @@ -199,8 +199,8 @@ conf_init(struct conf *c) conf_mousebind(c, m_binds[i].key, m_binds[i].func); /* Default term/lock */ - strlcpy(c->termpath, "xterm", sizeof(c->termpath)); - strlcpy(c->lockpath, "xlock", sizeof(c->lockpath)); + (void)strlcpy(c->termpath, "xterm", sizeof(c->termpath)); + (void)strlcpy(c->lockpath, "xlock", sizeof(c->lockpath)); c->color[CWM_COLOR_BORDER_ACTIVE].name = xstrdup(CONF_COLOR_ACTIVEBORDER); @@ -273,13 +273,14 @@ conf_setup(struct conf *c, const char *conf_file) if (home == NULL) errx(1, "No HOME directory."); - snprintf(c->conf_path, sizeof(c->conf_path), "%s/%s", home, - CONFFILE); + (void)snprintf(c->conf_path, sizeof(c->conf_path), "%s/%s", + home, CONFFILE); } else if (stat(conf_file, &sb) == -1 || !(sb.st_mode & S_IFREG)) errx(1, "%s: %s", conf_file, strerror(errno)); else - strlcpy(c->conf_path, conf_file, sizeof(c->conf_path)); + (void)strlcpy(c->conf_path, conf_file, + sizeof(c->conf_path)); conf_init(c); diff --git a/app/cwm/group.c b/app/cwm/group.c index 49b190084..cbc695165 100644 --- a/app/cwm/group.c +++ b/app/cwm/group.c @@ -16,7 +16,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: group.c,v 1.50 2011/05/11 13:53:51 okan Exp $ + * $OpenBSD: group.c,v 1.51 2011/07/25 15:10:24 okan Exp $ */ #include <sys/param.h> @@ -377,10 +377,10 @@ group_menu(XButtonEvent *e) mi = xcalloc(1, sizeof(*mi)); if (gc->hidden) - snprintf(mi->text, sizeof(mi->text), "%d: [%s]", + (void)snprintf(mi->text, sizeof(mi->text), "%d: [%s]", gc->shortcut, sc->group_names[i]); else - snprintf(mi->text, sizeof(mi->text), "%d: %s", + (void)snprintf(mi->text, sizeof(mi->text), "%d: %s", gc->shortcut, sc->group_names[i]); mi->ctx = gc; TAILQ_INSERT_TAIL(&menuq, mi, entry); @@ -533,7 +533,7 @@ group_set_names(struct screen_ctx *sc) tlen = len; for (i = 0; i < sc->group_nonames; i++) { slen = strlen(sc->group_names[i]) + 1; - strlcpy(q, sc->group_names[i], tlen); + (void)strlcpy(q, sc->group_names[i], tlen); tlen -= slen; q += slen; } diff --git a/app/cwm/kbfunc.c b/app/cwm/kbfunc.c index ba34a77e5..ced4081fb 100644 --- a/app/cwm/kbfunc.c +++ b/app/cwm/kbfunc.c @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: kbfunc.c,v 1.56 2011/07/23 13:09:11 okan Exp $ + * $OpenBSD: kbfunc.c,v 1.57 2011/07/25 15:10:24 okan Exp $ */ #include <sys/param.h> @@ -157,7 +157,7 @@ kbfunc_client_search(struct client_ctx *cc, union arg *arg) TAILQ_FOREACH(cc, &Clientq, entry) { mi = xcalloc(1, sizeof(*mi)); - strlcpy(mi->text, cc->name, sizeof(mi->text)); + (void)strlcpy(mi->text, cc->name, sizeof(mi->text)); mi->ctx = cc; TAILQ_INSERT_TAIL(&menuq, mi, entry); } @@ -192,7 +192,7 @@ kbfunc_menu_search(struct client_ctx *cc, union arg *arg) TAILQ_FOREACH(cmd, &Conf.cmdq, entry) { mi = xcalloc(1, sizeof(*mi)); - strlcpy(mi->text, cmd->label, sizeof(mi->text)); + (void)strlcpy(mi->text, cmd->label, sizeof(mi->text)); mi->ctx = cmd; TAILQ_INSERT_TAIL(&menuq, mi, entry); } @@ -291,7 +291,7 @@ kbfunc_exec(struct client_ctx *cc, union arg *arg) /* skip everything but regular files and symlinks */ if (dp->d_type != DT_REG && dp->d_type != DT_LNK) continue; - memset(tpath, '\0', sizeof(tpath)); + (void)memset(tpath, '\0', sizeof(tpath)); l = snprintf(tpath, sizeof(tpath), "%s/%s", paths[i], dp->d_name); /* check for truncation etc */ @@ -299,7 +299,8 @@ kbfunc_exec(struct client_ctx *cc, union arg *arg) continue; if (access(tpath, X_OK) == 0) { mi = xcalloc(1, sizeof(*mi)); - strlcpy(mi->text, dp->d_name, sizeof(mi->text)); + (void)strlcpy(mi->text, + dp->d_name, sizeof(mi->text)); TAILQ_INSERT_TAIL(&menuq, mi, entry); } } @@ -366,7 +367,7 @@ kbfunc_ssh(struct client_ctx *cc, union arg *arg) else { /* EOF without EOL, copy and add the NUL */ lbuf = xmalloc(len + 1); - memcpy(lbuf, buf, len); + (void)memcpy(lbuf, buf, len); lbuf[len] = '\0'; buf = lbuf; } @@ -379,13 +380,13 @@ kbfunc_ssh(struct client_ctx *cc, union arg *arg) /* ignore badness */ if (p - buf + 1 > sizeof(hostbuf)) continue; - (void) strlcpy(hostbuf, buf, p - buf + 1); + (void)strlcpy(hostbuf, buf, p - buf + 1); mi = xcalloc(1, sizeof(*mi)); - (void) strlcpy(mi->text, hostbuf, sizeof(mi->text)); + (void)strlcpy(mi->text, hostbuf, sizeof(mi->text)); TAILQ_INSERT_TAIL(&menuq, mi, entry); } xfree(lbuf); - fclose(fp); + (void)fclose(fp); if ((mi = menu_filter(sc, &menuq, "ssh", NULL, 1, search_match_exec, NULL)) != NULL) { diff --git a/app/cwm/menu.c b/app/cwm/menu.c index 175c59691..d9b1e68a4 100644 --- a/app/cwm/menu.c +++ b/app/cwm/menu.c @@ -16,7 +16,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: menu.c,v 1.30 2011/07/23 13:09:11 okan Exp $ + * $OpenBSD: menu.c,v 1.31 2011/07/25 15:10:24 okan Exp $ */ #include <sys/param.h> @@ -118,16 +118,16 @@ menu_filter(struct screen_ctx *sc, struct menu_q *menuq, char *prompt, mc.list = 1; } else { evmask = MENUMASK | KEYMASK; /* only accept keys if prompt */ - snprintf(mc.promptstr, sizeof(mc.promptstr), "%s%s", prompt, - PROMPT_SCHAR); - snprintf(mc.dispstr, sizeof(mc.dispstr), "%s%s%s", mc.promptstr, - mc.searchstr, PROMPT_ECHAR); + (void)snprintf(mc.promptstr, sizeof(mc.promptstr), "%s%s", + prompt, PROMPT_SCHAR); + (void)snprintf(mc.dispstr, sizeof(mc.dispstr), "%s%s%s", + mc.promptstr, mc.searchstr, PROMPT_ECHAR); mc.width = font_width(sc, mc.dispstr, strlen(mc.dispstr)); mc.hasprompt = 1; } if (initial != NULL) - strlcpy(mc.searchstr, initial, sizeof(mc.searchstr)); + (void)strlcpy(mc.searchstr, initial, sizeof(mc.searchstr)); else mc.searchstr[0] = '\0'; @@ -268,7 +268,7 @@ menu_handle_key(XEvent *e, struct menu_ctx *mc, struct menu_q *menuq, str[0] = chr; str[1] = '\0'; mc->changed = 1; - strlcat(mc->searchstr, str, sizeof(mc->searchstr)); + (void)strlcat(mc->searchstr, str, sizeof(mc->searchstr)); } mc->noresult = 0; @@ -312,7 +312,7 @@ menu_draw(struct screen_ctx *sc, struct menu_ctx *mc, struct menu_q *menuq, mc->width = 0; dy = 0; if (mc->hasprompt) { - snprintf(mc->dispstr, sizeof(mc->dispstr), "%s%s%s", + (void)snprintf(mc->dispstr, sizeof(mc->dispstr), "%s%s%s", mc->promptstr, mc->searchstr, PROMPT_ECHAR); mc->width = font_width(sc, mc->dispstr, strlen(mc->dispstr)); dy = font_height(sc); @@ -405,11 +405,11 @@ menu_handle_move(XEvent *e, struct menu_ctx *mc, struct screen_ctx *sc) XFillRectangle(X_Dpy, sc->menuwin, sc->gc, 0, font_height(sc) * mc->prev, mc->width, font_height(sc)); if (mc->entry != -1) { - xu_ptr_regrab(MENUGRABMASK, Cursor_normal); + (void)xu_ptr_regrab(MENUGRABMASK, Cursor_normal); XFillRectangle(X_Dpy, sc->menuwin, sc->gc, 0, font_height(sc) * mc->entry, mc->width, font_height(sc)); } else - xu_ptr_regrab(MENUGRABMASK, Cursor_default); + (void)xu_ptr_regrab(MENUGRABMASK, Cursor_default); } static struct menu * diff --git a/app/cwm/mousefunc.c b/app/cwm/mousefunc.c index 4acbc6d52..9f4402949 100644 --- a/app/cwm/mousefunc.c +++ b/app/cwm/mousefunc.c @@ -16,7 +16,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: mousefunc.c,v 1.31 2011/07/23 13:09:11 okan Exp $ + * $OpenBSD: mousefunc.c,v 1.32 2011/07/25 15:10:24 okan Exp $ */ #include <sys/param.h> @@ -57,7 +57,7 @@ mousefunc_sweep_draw(struct client_ctx *cc) char asize[10]; /* fits "nnnnxnnnn\0" */ int width, width_size, width_name; - snprintf(asize, sizeof(asize), "%dx%d", + (void)snprintf(asize, sizeof(asize), "%dx%d", (cc->geom.width - cc->geom.basew) / cc->geom.incw, (cc->geom.height - cc->geom.baseh) / cc->geom.inch); width_size = font_width(sc, asize, strlen(asize)) + 4; @@ -234,7 +234,7 @@ mousefunc_menu_unhide(struct client_ctx *cc, void *arg) continue; mi = xcalloc(1, sizeof(*mi)); - strlcpy(mi->text, wname, sizeof(mi->text)); + (void)strlcpy(mi->text, wname, sizeof(mi->text)); mi->ctx = cc; TAILQ_INSERT_TAIL(&menuq, mi, entry); } @@ -271,7 +271,7 @@ mousefunc_menu_cmd(struct client_ctx *cc, void *arg) TAILQ_INIT(&menuq); TAILQ_FOREACH(cmd, &Conf.cmdq, entry) { mi = xcalloc(1, sizeof(*mi)); - strlcpy(mi->text, cmd->label, sizeof(mi->text)); + (void)strlcpy(mi->text, cmd->label, sizeof(mi->text)); mi->ctx = cmd; TAILQ_INSERT_TAIL(&menuq, mi, entry); } diff --git a/app/cwm/parse.y b/app/cwm/parse.y index 4bfdaa623..94dc862aa 100644 --- a/app/cwm/parse.y +++ b/app/cwm/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.28 2011/07/14 11:39:53 okan Exp $ */ +/* $OpenBSD: parse.y,v 1.29 2011/07/25 15:10:24 okan Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -142,7 +142,7 @@ main : FONTNAME STRING { struct winmatch *wm; wm = xcalloc(1, sizeof(*wm)); - strlcpy(wm->title, $2, sizeof(wm->title)); + (void)strlcpy(wm->title, $2, sizeof(wm->title)); TAILQ_INSERT_TAIL(&conf->ignoreq, wm, entry); free($2); @@ -502,7 +502,7 @@ parse_config(const char *filename, struct conf *xconf) return (-1); } - strlcpy(conf->conf_path, filename, sizeof(conf->conf_path)); + (void)strlcpy(conf->conf_path, filename, sizeof(conf->conf_path)); conf_init(conf); @@ -555,9 +555,9 @@ parse_config(const char *filename, struct conf *xconf) TAILQ_INSERT_TAIL(&xconf->mousebindingq, mb, entry); } - strlcpy(xconf->termpath, conf->termpath, + (void)strlcpy(xconf->termpath, conf->termpath, sizeof(xconf->termpath)); - strlcpy(xconf->lockpath, conf->lockpath, + (void)strlcpy(xconf->lockpath, conf->lockpath, sizeof(xconf->lockpath)); for (i = 0; i < CWM_COLOR_MAX; i++) diff --git a/app/cwm/search.c b/app/cwm/search.c index 79e1015e7..9db2f706f 100644 --- a/app/cwm/search.c +++ b/app/cwm/search.c @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: search.c,v 1.23 2011/05/11 13:53:51 okan Exp $ + * $OpenBSD: search.c,v 1.24 2011/07/25 15:10:24 okan Exp $ */ #include <sys/param.h> @@ -46,7 +46,7 @@ search_match_client(struct menu_q *menuq, struct menu_q *resultq, char *search) TAILQ_INIT(resultq); - memset(tierp, 0, sizeof(tierp)); + (void)memset(tierp, 0, sizeof(tierp)); /* * In order of rank: @@ -134,7 +134,8 @@ search_print_client(struct menu *mi, int list) if (list) cc->matchname = cc->name; - snprintf(mi->print, sizeof(mi->print), "%c%s", flag, cc->matchname); + (void)snprintf(mi->print, sizeof(mi->print), "%c%s", flag, + cc->matchname); if (!list && cc->matchname != cc->name && strlen(mi->print) < sizeof(mi->print) - 1) { @@ -154,8 +155,8 @@ search_print_client(struct menu *mi, int list) diff = strlen(cc->name); } - strlcpy(buf, mi->print, sizeof(buf)); - snprintf(mi->print, sizeof(mi->print), + (void)strlcpy(buf, mi->print, sizeof(buf)); + (void)snprintf(mi->print, sizeof(mi->print), "%s:%.*s%s", buf, diff, cc->name, marker); } } diff --git a/app/cwm/util.c b/app/cwm/util.c index aa159009c..f9d0ed71e 100644 --- a/app/cwm/util.c +++ b/app/cwm/util.c @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: util.c,v 1.14 2011/06/24 05:40:09 okan Exp $ + * $OpenBSD: util.c,v 1.15 2011/07/25 15:10:24 okan Exp $ */ #include <sys/param.h> @@ -76,6 +76,6 @@ u_exec(char *argstr) } *ap = NULL; - setsid(); - execvp(args[0], args); + (void)setsid(); + (void)execvp(args[0], args); } diff --git a/app/cwm/xutil.c b/app/cwm/xutil.c index 34c1a0755..859cf512b 100644 --- a/app/cwm/xutil.c +++ b/app/cwm/xutil.c @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: xutil.c,v 1.36 2011/07/23 13:09:11 okan Exp $ + * $OpenBSD: xutil.c,v 1.37 2011/07/25 15:10:24 okan Exp $ */ #include <sys/param.h> @@ -142,7 +142,7 @@ xu_sendmsg(Window win, Atom atm, long val) { XEvent e; - memset(&e, 0, sizeof(e)); + (void)memset(&e, 0, sizeof(e)); e.xclient.type = ClientMessage; e.xclient.window = win; e.xclient.message_type = atm; |