X-Git-Url: https://git.danieliu.xyz/?p=dwm.git;a=blobdiff_plain;f=util.h;h=f633b5173ad2b5058d48574d5a18fe3f135c4193;hp=76fc09f59b1089da9f3a851d1c9f2dbf0394f58f;hb=HEAD;hpb=b1669b5c48f71c9a7a919dbf09a1af527c62f69a diff --git a/util.h b/util.h index 76fc09f..f633b51 100644 --- a/util.h +++ b/util.h @@ -1,22 +1,8 @@ -/* - * (C)opyright MMVI Anselm R. Garbe - * See LICENSE file for license details. - */ -#include +/* See LICENSE file for copyright and license details. */ -extern void error(char *errstr, ...); -extern void *emallocz(unsigned int size); -extern void *emalloc(unsigned int size); -extern void *erealloc(void *ptr, unsigned int size); -extern char *estrdup(const char *str); -#define eassert(a) \ - do { \ - if(!(a)) \ - failed_assert(#a, __FILE__, __LINE__); \ - } while (0) -extern void failed_assert(char *a, char *file, int line); -extern void pipe_spawn(char *buf, unsigned int len, Display *dpy, char *argv[]); -extern void spawn(Display *dpy, char *argv[]); -extern void swap(void **p1, void **p2); -extern unsigned int tokenize(char **result, unsigned int reslen, - char *str, char delim); +#define MAX(A, B) ((A) > (B) ? (A) : (B)) +#define MIN(A, B) ((A) < (B) ? (A) : (B)) +#define BETWEEN(X, A, B) ((A) <= (X) && (X) <= (B)) + +void die(const char *fmt, ...); +void *ecalloc(size_t nmemb, size_t size);