Go to the documentation of this file. 1 #ifndef __XMMS_UTILS_H__
2 #define __XMMS_UTILS_H__
9 #define XMMS_STRINGIFY_NOEXPAND(x) #x
10 #define XMMS_STRINGIFY(x) XMMS_STRINGIFY_NOEXPAND(x)
12 #define x_return_if_fail(expr) if (!(expr)) { fprintf (stderr, "Failed in file " __FILE__ " on row %d\n", __LINE__); return; }
13 #define x_return_val_if_fail(expr, val) if (!(expr)) { fprintf (stderr, "Failed in file " __FILE__ " on row %d\n", __LINE__); return val; }
14 #define x_return_null_if_fail(expr) x_return_val_if_fail (expr, NULL)
15 #define x_oom() do { fprintf(stderr, "Out of memory in " __FILE__ "on row %d\n", __LINE__); } while (0)
16 #define x_new0(type, num) calloc (1, sizeof (type) * (num))
17 #define x_new(type, num) malloc (sizeof (type) * (num))
18 #define x_malloc0(size) calloc (1, size)
19 #define x_malloc(size) malloc (size)
23 #if defined(__x86_64__)
24 # define XPOINTER_TO_INT(p) ((int) (long) (p))
25 # define XPOINTER_TO_UINT(p) ((unsigned int) (unsigned long) (p))
26 # define XINT_TO_POINTER(i) ((void *) (long) (i))
27 # define XUINT_TO_POINTER(u) ((void *) (unsigned long) (u))
29 # define XPOINTER_TO_INT(p) ((int) (p))
30 # define XPOINTER_TO_UINT(p) ((unsigned int) (p))
31 # define XINT_TO_POINTER(i) ((void *) (i))
32 # define XUINT_TO_POINTER(u) ((void *) (u))
36 # define MIN(a, b) (((a) < (b)) ? (a) : (b))
40 # define X_N_ELEMENTS(a) (sizeof (a) / sizeof ((a)[0]))
43 #define XMMS_PATH_MAX 255
46 #define XMMS_DEFAULT_TCP_PORT 9667
const char * xmms_fallback_ipcpath_get(char *buf, int len)
Get the fallback connection path (if XMMS_PATH is not accessible)
const char * xmms_usercachedir_get(char *buf, int len)
Get the absolute path to the user cache dir.
bool xmms_sleep_ms(int n)
Sleep for n milliseconds.
const char * xmms_default_ipcpath_get(char *buf, int len)
Get the default connection path.
const char * xmms_userconfdir_get(char *buf, int len)
Get the absolute path to the user config dir.