mirror of
https://github.com/0intro/wmii
synced 2025-03-29 18:12:59 +03:00
X/\.c$/ ,s/wmiiwm/wmii/g. Don't use printf (may malloc) on malloc failure.
This commit is contained in:
parent
7fee0ec5e2
commit
dd0b7f5123
7
area.c
7
area.c
@ -1,5 +1,5 @@
|
||||
/* © 2004-2006 Anselm R. Garbe <garbeam at gmail dot com>
|
||||
* © 2006-2007 Kris Maglione <fbsdaemon@gmail.com>
|
||||
/* ©2004-2006 Anselm R. Garbe <garbeam at gmail dot com>
|
||||
* ©2006-2007 Kris Maglione <fbsdaemon@gmail.com>
|
||||
* See LICENSE file for license details.
|
||||
*/
|
||||
#include <assert.h>
|
||||
@ -82,7 +82,8 @@ destroy_area(Area *a) {
|
||||
|
||||
v = a->view;
|
||||
|
||||
assert(!a->frame && "wmiiwm: fatal, destroying non-empty area");
|
||||
if(a->frame)
|
||||
fatal("destroying non-empty area");
|
||||
if(v->revert == a)
|
||||
v->revert = nil;
|
||||
for(c=client; c; c=c->next)
|
||||
|
4
bar.c
4
bar.c
@ -1,5 +1,5 @@
|
||||
/* © 2004-2006 Anselm R. Garbe <garbeam at gmail dot com>
|
||||
* © 2006-2007 Kris Maglione <fbsdaemon@gmail.com>
|
||||
/* ©2004-2006 Anselm R. Garbe <garbeam at gmail dot com>
|
||||
* ©2006-2007 Kris Maglione <fbsdaemon@gmail.com>
|
||||
* See LICENSE file for license details.
|
||||
*/
|
||||
#include <math.h>
|
||||
|
4
client.c
4
client.c
@ -1,5 +1,5 @@
|
||||
/* © 2004-2006 Anselm R. Garbe <garbeam at gmail dot com>
|
||||
* © 2006-2007 Kris Maglione <fbsdaemon@gmail.com>
|
||||
/* ©2004-2006 Anselm R. Garbe <garbeam at gmail dot com>
|
||||
* ©2006-2007 Kris Maglione <fbsdaemon@gmail.com>
|
||||
* See LICENSE file for license details.
|
||||
*/
|
||||
#include <assert.h>
|
||||
|
4
column.c
4
column.c
@ -1,5 +1,5 @@
|
||||
/* © 2004-2006 Anselm R. Garbe <garbeam at gmail dot com>
|
||||
* © 2006-2007 Kris Maglione <fbsdaemon@gmail.com>
|
||||
/* ©2004-2006 Anselm R. Garbe <garbeam at gmail dot com>
|
||||
* ©2006-2007 Kris Maglione <fbsdaemon@gmail.com>
|
||||
* See LICENSE file for license details.
|
||||
*/
|
||||
#include <assert.h>
|
||||
|
4
draw.c
4
draw.c
@ -1,4 +1,4 @@
|
||||
/* © 2004-2006 Anselm R. Garbe <garbeam at gmail dot com>
|
||||
/* ©2004-2006 Anselm R. Garbe <garbeam at gmail dot com>
|
||||
* See LICENSE file for license details.
|
||||
*/
|
||||
#include <stdio.h>
|
||||
@ -32,7 +32,7 @@ loadfont(Blitz *blitz, BlitzFont *font) {
|
||||
font->set = XCreateFontSet(blitz->dpy, fontname, &missing, &n, &def);
|
||||
if(missing) {
|
||||
while(n--)
|
||||
fprintf(stderr, "wmiiwm: missing fontset for '%s': %s\n",
|
||||
fprintf(stderr, "wmii: missing fontset for '%s': %s\n",
|
||||
fontname, missing[n]);
|
||||
XFreeStringList(missing);
|
||||
}
|
||||
|
4
event.c
4
event.c
@ -1,5 +1,5 @@
|
||||
/* © 2004-2006 Anselm R. Garbe <garbeam at gmail dot com>
|
||||
* © 2006-2007 Kris Maglione <fbsdaemon@gmail.com>
|
||||
/* ©2004-2006 Anselm R. Garbe <garbeam at gmail dot com>
|
||||
* ©2006-2007 Kris Maglione <fbsdaemon@gmail.com>
|
||||
* See LICENSE file for license details.
|
||||
*/
|
||||
#include <fcntl.h>
|
||||
|
2
frame.c
2
frame.c
@ -1,4 +1,4 @@
|
||||
/* © 2006-2007 Kris Maglione <fbsdaemon@gmail.com>
|
||||
/* ©2006-2007 Kris Maglione <fbsdaemon@gmail.com>
|
||||
* See LICENSE file for license details.
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
|
4
fs.c
4
fs.c
@ -1,4 +1,4 @@
|
||||
/* © 2006 Kris Maglione <fbsdaemon at gmail dot com>
|
||||
/* ©2006 Kris Maglione <fbsdaemon at gmail dot com>
|
||||
* See LICENSE file for license details.
|
||||
*/
|
||||
#include <assert.h>
|
||||
@ -244,7 +244,7 @@ message_root(char *message)
|
||||
else if(!strncmp(message, "view ", 5))
|
||||
select_view(&message[5]);
|
||||
else if(!strncmp(message, "selcolors ", 10)) {
|
||||
fprintf(stderr, "wmiiwm: warning: selcolors have been removed\n");
|
||||
fprintf(stderr, "wmii: warning: selcolors have been removed\n");
|
||||
return Ebadcmd;
|
||||
}
|
||||
else if(!strncmp(message, "focuscolors ", 12)) {
|
||||
|
2
geom.c
2
geom.c
@ -1,4 +1,4 @@
|
||||
/* © 2004-2006 Anselm R. Garbe <garbeam at gmail dot com>
|
||||
/* ©2004-2006 Anselm R. Garbe <garbeam at gmail dot com>
|
||||
* See LICENSE file for license details.
|
||||
*/
|
||||
#include "wmii.h"
|
||||
|
2
key.c
2
key.c
@ -1,4 +1,4 @@
|
||||
/* © 2004-2006 Anselm R. Garbe <garbeam at gmail dot com>
|
||||
/* ©2004-2006 Anselm R. Garbe <garbeam at gmail dot com>
|
||||
* See LICENSE file for license details.
|
||||
*/
|
||||
#include <string.h>
|
||||
|
10
main.c
10
main.c
@ -1,5 +1,5 @@
|
||||
/* © 2004-2006 Anselm R. Garbe <garbeam at gmail dot com>
|
||||
* © 2006-2007 Kris Maglione <fbsdaemon@gmail.com>
|
||||
/* ©2004-2006 Anselm R. Garbe <garbeam at gmail dot com>
|
||||
* ©2006-2007 Kris Maglione <fbsdaemon@gmail.com>
|
||||
* See LICENSE file for license details.
|
||||
*/
|
||||
#include <X11/Xatom.h>
|
||||
@ -22,7 +22,7 @@
|
||||
#define nelem(ary) (sizeof(ary) / sizeof(*ary))
|
||||
|
||||
static const char
|
||||
version[] = "wmiiwm - " VERSION ", ©2007 Kris Maglione\n";
|
||||
version[] = "wmii - " VERSION ", ©2007 Kris Maglione\n";
|
||||
|
||||
static int (*x_error_handler) (Display *, XErrorEvent *);
|
||||
static char *address, *ns_path;
|
||||
@ -33,7 +33,7 @@ static int sleeperfd, sock;
|
||||
|
||||
static void
|
||||
usage() {
|
||||
fatal("usage: wmiiwm -a <address> [-r <wmiirc>] [-v]\n");
|
||||
fatal("usage: wmii [-a <address>] [-r <wmiirc>] [-v]\n");
|
||||
}
|
||||
|
||||
static void
|
||||
@ -281,7 +281,7 @@ wmii_error_handler(Display *dpy, XErrorEvent *error) {
|
||||
&& error->error_code == BadAccess))
|
||||
return 0;
|
||||
|
||||
fprintf(stderr, "wmiiwm: fatal error: Xrequest code=%d, Xerror code=%d\n",
|
||||
fprintf(stderr, "wmii: fatal error: Xrequest code=%d, Xerror code=%d\n",
|
||||
error->request_code, error->error_code);
|
||||
return x_error_handler(blz.dpy, error); /* calls exit() */
|
||||
}
|
||||
|
2
mouse.c
2
mouse.c
@ -1,4 +1,4 @@
|
||||
/* © 2006 Kris Maglione <fbsdaemon@gmail.com>
|
||||
/* ©2006 Kris Maglione <fbsdaemon@gmail.com>
|
||||
* See LICENSE file for license details.
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
|
2
rule.c
2
rule.c
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* © 2006 Anselm R. Garbe <garbeam at gmail dot com>
|
||||
* ©2006 Anselm R. Garbe <garbeam at gmail dot com>
|
||||
* See LICENSE file for license details.
|
||||
*/
|
||||
|
||||
|
32
util.c
32
util.c
@ -5,6 +5,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include "wmii.h"
|
||||
|
||||
void
|
||||
@ -13,7 +14,7 @@ fatal(const char *fmt, ...) {
|
||||
int err;
|
||||
|
||||
err = errno;
|
||||
fprintf(stderr, "wmiiwm: fatal: ");
|
||||
fprintf(stderr, "wmii: fatal: ");
|
||||
|
||||
va_start(ap, fmt);
|
||||
vfprintf(stderr, fmt, ap);
|
||||
@ -27,11 +28,34 @@ fatal(const char *fmt, ...) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* Can't malloc */
|
||||
void
|
||||
mfatal(char *name, int size) {
|
||||
const char
|
||||
couldnot[] = "Could not ",
|
||||
paren[] = "() ",
|
||||
bytes[] = " bytes\n";
|
||||
char sizestr[8];
|
||||
int i;
|
||||
|
||||
i = sizeof(sizestr);
|
||||
do {
|
||||
sizestr[--i] = size&8;
|
||||
size >>= 8;
|
||||
} while(size > 0);
|
||||
|
||||
write(1, couldnot, sizeof(couldnot)-1);
|
||||
write(1, name, strlen(name));
|
||||
write(1, paren, sizeof(paren)-1);
|
||||
write(1, sizestr+i, sizeof(sizestr)-i);
|
||||
write(1, bytes, sizeof(bytes)-1);
|
||||
}
|
||||
|
||||
void *
|
||||
emalloc(uint size) {
|
||||
void *ret = malloc(size);
|
||||
if(!ret)
|
||||
fatal("could not malloc() %d bytes", size);
|
||||
mfatal("malloc", size);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -46,7 +70,7 @@ void *
|
||||
erealloc(void *ptr, uint size) {
|
||||
void *ret = realloc(ptr, size);
|
||||
if(!ret)
|
||||
fatal("fatal: could not realloc() %d bytes", size);
|
||||
mfatal("realloc", size);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -54,7 +78,7 @@ char *
|
||||
estrdup(const char *str) {
|
||||
void *ret = strdup(str);
|
||||
if(!ret)
|
||||
fatal("fatal: could not strdup() %u bytes", strlen(str));
|
||||
mfatal("strdup", strlen(str));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user