X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=para.h;h=5dec070f00458bd59d62fbb8fed1b3bc60cb31da;hp=a4753d4b5f5afa4eedc9a982f15f33c2f175626d;hb=aa1b3b3b2398efd04a95168b9124f51f7d6912cc;hpb=b42f370628f56fdf0d7b9261567eb2033c9ae18a diff --git a/para.h b/para.h index a4753d4b..5dec070f 100644 --- a/para.h +++ b/para.h @@ -140,10 +140,6 @@ /** sent by para_client, followed by the decrypted challenge number */ #define CHALLENGE_RESPONSE_MSG "challenge_response:" -/* gui_common */ -int para_open_audiod_pipe(char *); -int read_audiod_pipe(int, void (*)(char *)); - /* exec */ int para_exec_cmdline_pid(pid_t *pid, const char *cmdline, int *fds); @@ -177,7 +173,6 @@ int stat_item_valid(const char *item); int stat_line_valid(const char *); void stat_client_write(const char *msg, int itemnum); int stat_client_add(int fd, long unsigned mask); -size_t for_each_line(char *buf, size_t n, void (*line_handler)(char *)); #define FOR_EACH_STAT_ITEM(i) for (i = 0; i < NUM_STAT_ITEMS; i++) __printf_2_3 void para_log(int, const char*, ...); @@ -205,3 +200,14 @@ __printf_2_3 void para_log(int, const char*, ...); p = para_realloc(p, size); \ } \ } + +static inline int para_random(unsigned max) +{ + return ((max + 0.0) * (rand() / (RAND_MAX + 1.0))); +} + +/** Round up x to a multiple of y */ +#define ROUND_UP(x, y) (((x) + (y - 1) / (y)) * (y)) + +/** Get the size of an array */ +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))