aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorokan2011-07-25 15:10:24 +0000
committerokan2011-07-25 15:10:24 +0000
commit02915d130c044aa89ceff108b868c705856a35ca (patch)
tree819b08241dca0050a75a5ec1af2cc17fb98d8382
parent1ef8b9886258d857d0c25c9ab2f5220b4acb8065 (diff)
downloadcwm-02915d130c044aa89ceff108b868c705856a35ca.tar.gz
We are inconsistent when it comes to function returns, so just go all
the way with the cwm specific parts. ok oga@
-rw-r--r--calmwm.c9
-rw-r--r--conf.c21
-rw-r--r--group.c8
-rw-r--r--kbfunc.c19
-rw-r--r--menu.c20
-rw-r--r--mousefunc.c8
-rw-r--r--parse.y10
-rw-r--r--search.c11
-rw-r--r--util.c6
-rw-r--r--xutil.c4
10 files changed, 60 insertions, 56 deletions
diff --git a/calmwm.c b/calmwm.c
index 5fb67f6..50ef2f4 100644
--- a/calmwm.c
+++ b/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/conf.c b/conf.c
index 1066c49..63dae30 100644
--- a/conf.c
+++ b/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/group.c b/group.c
index 49b1900..cbc6951 100644
--- a/group.c
+++ b/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/kbfunc.c b/kbfunc.c
index ba34a77..ced4081 100644
--- a/kbfunc.c
+++ b/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/menu.c b/menu.c
index 175c596..d9b1e68 100644
--- a/menu.c
+++ b/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/mousefunc.c b/mousefunc.c
index 4acbc6d..9f44029 100644
--- a/mousefunc.c
+++ b/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/parse.y b/parse.y
index 4bfdaa6..94dc862 100644
--- a/parse.y
+++ b/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/search.c b/search.c
index 79e1015..9db2f70 100644
--- a/search.c
+++ b/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/util.c b/util.c
index aa15900..f9d0ed7 100644
--- a/util.c
+++ b/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/xutil.c b/xutil.c
index 34c1a07..859cf51 100644
--- a/xutil.c
+++ b/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;