2001-07-30 09:59:37 -07:00
|
|
|
#ifndef E_UTIL_H
|
|
|
|
#define E_UTIL_H
|
|
|
|
|
|
|
|
#include "e.h"
|
|
|
|
|
2001-11-03 01:07:40 -08:00
|
|
|
void e_util_set_env(char *variable, char *content);
|
|
|
|
char *e_util_get_user_home(void);
|
|
|
|
void *e_util_memdup(void *data, int size);
|
|
|
|
int e_util_glob_matches(char *str, char *glob);
|
2001-07-30 09:59:37 -07:00
|
|
|
|
2001-08-16 01:45:37 -07:00
|
|
|
#define e_strdup(__dest, __var) \
|
|
|
|
{ \
|
|
|
|
if (!__var) __dest = NULL; \
|
|
|
|
else { \
|
|
|
|
__dest = malloc(strlen(__var) + 1); \
|
|
|
|
if (__dest) strcpy(__dest, __var); \
|
|
|
|
} }
|
|
|
|
|
2001-11-03 06:55:21 -08:00
|
|
|
/* misc util macros */
|
|
|
|
#define INTERSECTS(x, y, w, h, xx, yy, ww, hh) \
|
|
|
|
(((x) < ((xx) + (ww))) && \
|
|
|
|
((y) < ((yy) + (hh))) && \
|
|
|
|
(((x) + (w)) > (xx)) && \
|
|
|
|
(((y) + (h)) > (yy)))
|
|
|
|
#define SPANS_COMMON(x1, w1, x2, w2) \
|
|
|
|
(!((((x2) + (w2)) <= (x1)) || ((x2) >= ((x1) + (w1)))))
|
|
|
|
#define UN(_blah) _blah = 0
|
|
|
|
|
2001-07-30 09:59:37 -07:00
|
|
|
#endif
|