toxcore/testing/hstox/util.h
iphydf c037100747
Import the hstox SUT interface from hstox.
We'll maintain it in the c-toxcore repo, where it belongs.
2016-10-01 02:13:34 +01:00

28 lines
1.5 KiB
C

#pragma once
#include <msgpack.h>
#define check_return(err, expr) \
__extension__({ \
__typeof__(expr) _r = (expr); \
if (_r < 0) \
return err | (__LINE__ << 16); \
_r; \
})
#define propagate(expr) \
do { \
__typeof__(expr) _r = (expr); \
if (_r != E_OK) \
return _r; \
} while (0)
char const *type_name(msgpack_object_type type);
// Statically allocated "asprintf".
char const *ssprintf(char const *fmt, ...);
int msgpack_pack_string(msgpack_packer *pk, char const *str);
int msgpack_pack_stringf(msgpack_packer *pk, char const *fmt, ...);
int msgpack_pack_vstringf(msgpack_packer *pk, char const *fmt, va_list ap);