mirror of git://git.suckless.org/svkbd
put estrdup in util and use die() instead of BSD err()
This commit is contained in:
parent
b80819aa3f
commit
d19a80dfe5
9
svkbd.c
9
svkbd.c
|
@ -11,7 +11,6 @@
|
|||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <ctype.h>
|
||||
#include <err.h>
|
||||
|
||||
#include <X11/keysym.h>
|
||||
#include <X11/keysymdef.h>
|
||||
|
@ -85,8 +84,6 @@ static void togglelayer();
|
|||
static void unpress(Key *k, KeySym mod);
|
||||
static void updatekeys();
|
||||
static void printkey(Key *k, KeySym mod);
|
||||
static char *estrdup(const char *str);
|
||||
|
||||
|
||||
/* variables */
|
||||
static int screen;
|
||||
|
@ -138,12 +135,6 @@ Bool sigtermd = False;
|
|||
static Key keys[KEYS] = { NULL };
|
||||
static Key* layers[LAYERS];
|
||||
|
||||
char * estrdup(const char *str) {
|
||||
char * tmp = strdup(str);
|
||||
if (tmp == NULL) errx(1, "strdup failed");
|
||||
return tmp;
|
||||
}
|
||||
|
||||
void
|
||||
motionnotify(XEvent *e)
|
||||
{
|
||||
|
|
10
util.c
10
util.c
|
@ -16,6 +16,16 @@ ecalloc(size_t nmemb, size_t size)
|
|||
return p;
|
||||
}
|
||||
|
||||
char *
|
||||
estrdup(const char *s)
|
||||
{
|
||||
char *p;
|
||||
|
||||
if (!(p = strdup(s)))
|
||||
die("strdup:");
|
||||
return p;
|
||||
}
|
||||
|
||||
void
|
||||
die(const char *fmt, ...)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue