#include <stdio.h>
#include <stdlib.h>
#include "xmmsc/xmmsc_stdbool.h"
Go to the source code of this file.
|
#define | XMMS_STRINGIFY_NOEXPAND(x) #x |
|
#define | XMMS_STRINGIFY(x) XMMS_STRINGIFY_NOEXPAND(x) |
|
#define | x_return_if_fail(expr) if (!(expr)) { fprintf (stderr, "Failed in file " __FILE__ " on row %d\n", __LINE__); return; } |
|
#define | x_return_val_if_fail(expr, val) if (!(expr)) { fprintf (stderr, "Failed in file " __FILE__ " on row %d\n", __LINE__); return val; } |
|
#define | x_return_null_if_fail(expr) x_return_val_if_fail (expr, NULL) |
|
#define | x_oom() do { fprintf(stderr, "Out of memory in " __FILE__ "on row %d\n", __LINE__); } while (0) |
|
#define | x_new0(type, num) calloc (1, sizeof (type) * (num)) |
|
#define | x_new(type, num) malloc (sizeof (type) * (num)) |
|
#define | x_malloc0(size) calloc (1, size) |
|
#define | x_malloc(size) malloc (size) |
|
#define | XPOINTER_TO_INT(p) ((int) (p)) |
|
#define | XPOINTER_TO_UINT(p) ((unsigned int) (p)) |
|
#define | XINT_TO_POINTER(i) ((void *) (i)) |
|
#define | XUINT_TO_POINTER(u) ((void *) (u)) |
|
#define | MIN(a, b) (((a) < (b)) ? (a) : (b)) |
|
#define | X_N_ELEMENTS(a) (sizeof (a) / sizeof ((a)[0])) |
|
#define | XMMS_PATH_MAX 255 |
|
#define | XMMS_DEFAULT_TCP_PORT 9667 |
|
◆ MIN
#define MIN |
( |
|
a, |
|
|
|
b |
|
) |
| (((a) < (b)) ? (a) : (b)) |
◆ x_malloc
#define x_malloc |
( |
|
size | ) |
malloc (size) |
◆ x_malloc0
#define x_malloc0 |
( |
|
size | ) |
calloc (1, size) |
◆ X_N_ELEMENTS
#define X_N_ELEMENTS |
( |
|
a | ) |
(sizeof (a) / sizeof ((a)[0])) |
◆ x_new
#define x_new |
( |
|
type, |
|
|
|
num |
|
) |
| malloc (sizeof (type) * (num)) |
◆ x_new0
#define x_new0 |
( |
|
type, |
|
|
|
num |
|
) |
| calloc (1, sizeof (type) * (num)) |
◆ x_oom
#define x_oom |
( |
| ) |
do { fprintf(stderr, "Out of memory in " __FILE__ "on row %d\n", __LINE__); } while (0) |
◆ x_return_if_fail
#define x_return_if_fail |
( |
|
expr | ) |
if (!(expr)) { fprintf (stderr, "Failed in file " __FILE__ " on row %d\n", __LINE__); return; } |
◆ x_return_null_if_fail
◆ x_return_val_if_fail
#define x_return_val_if_fail |
( |
|
expr, |
|
|
|
val |
|
) |
| if (!(expr)) { fprintf (stderr, "Failed in file " __FILE__ " on row %d\n", __LINE__); return val; } |
◆ XINT_TO_POINTER
#define XINT_TO_POINTER |
( |
|
i | ) |
((void *) (i)) |
◆ XMMS_DEFAULT_TCP_PORT
#define XMMS_DEFAULT_TCP_PORT 9667 |
◆ XMMS_PATH_MAX
#define XMMS_PATH_MAX 255 |
◆ XMMS_STRINGIFY
◆ XMMS_STRINGIFY_NOEXPAND
#define XMMS_STRINGIFY_NOEXPAND |
( |
|
x | ) |
#x |
◆ XPOINTER_TO_INT
#define XPOINTER_TO_INT |
( |
|
p | ) |
((int) (p)) |
◆ XPOINTER_TO_UINT
#define XPOINTER_TO_UINT |
( |
|
p | ) |
((unsigned int) (p)) |
◆ XUINT_TO_POINTER
#define XUINT_TO_POINTER |
( |
|
u | ) |
((void *) (u)) |
◆ xmms_default_ipcpath_get()
const char * xmms_default_ipcpath_get |
( |
char * |
buf, |
|
|
int |
len |
|
) |
| |
Get the default connection path.
- Parameters
-
buf | A char buffer |
len | The length of buf (XMMS_PATH_MAX is a good choice) |
- Returns
- A pointer to buf, or NULL if an error occured.
Definition at line 35 of file utils.c.
◆ xmms_fallback_ipcpath_get()
const char * xmms_fallback_ipcpath_get |
( |
char * |
buf, |
|
|
int |
len |
|
) |
| |
Get the fallback connection path (if XMMS_PATH is not accessible)
- Parameters
-
buf | A char buffer |
len | The length of buf (XMMS_PATH_MAX is a good choice) |
- Returns
- A pointer to buf, or NULL if an error occured.
- Parameters
-
buf | A char buffer |
len | The length of buf (XMMS_PATH_MAX is a good choice) |
- Returns
- A pointer to buf, or NULL if an error occured.
Definition at line 93 of file utils_unix.c.
Referenced by main(), and xmms_default_ipcpath_get().
◆ xmms_sleep_ms()
bool xmms_sleep_ms |
( |
int |
n | ) |
|
Sleep for n milliseconds.
- Parameters
-
n | The number of milliseconds to sleep. |
- Returns
- true when we waited the full time, false otherwise.
Definition at line 114 of file utils_unix.c.
◆ xmms_usercachedir_get()
const char * xmms_usercachedir_get |
( |
char * |
buf, |
|
|
int |
len |
|
) |
| |
Get the absolute path to the user cache dir.
- Parameters
-
buf | a char buffer |
len | the lenght of buf (XMMS_PATH_MAX is a good choice) |
- Returns
- A pointer to buf, or NULL if an error occurred.
Definition at line 67 of file utils_unix.c.
◆ xmms_userconfdir_get()
const char * xmms_userconfdir_get |
( |
char * |
buf, |
|
|
int |
len |
|
) |
| |
Get the absolute path to the user config dir.
- Parameters
-
buf | A char buffer |
len | The length of buf (XMMS_PATH_MAX is a good choice) |
- Returns
- A pointer to buf, or NULL if an error occurred.
Definition at line 80 of file utils_unix.c.
Referenced by xmms_build_path().