Move some macros to common.c
This commit is contained in:
parent
57f052a2be
commit
852c2ac158
13
common.c
13
common.c
|
@ -34,6 +34,19 @@
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
|
|
||||||
|
/// Shorthand to set an error and return failure from the function
|
||||||
|
#define FAIL(...) \
|
||||||
|
BLOCK_START \
|
||||||
|
error_set (e, __VA_ARGS__); \
|
||||||
|
return false; \
|
||||||
|
BLOCK_END
|
||||||
|
|
||||||
|
// A few other debugging shorthands
|
||||||
|
#define LOG_FUNC_FAILURE(name, desc) \
|
||||||
|
print_debug ("%s: %s: %s", __func__, (name), (desc))
|
||||||
|
#define LOG_LIBC_FAILURE(name) \
|
||||||
|
print_debug ("%s: %s: %s", __func__, (name), strerror (errno))
|
||||||
|
|
||||||
// --- Logging -----------------------------------------------------------------
|
// --- Logging -----------------------------------------------------------------
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
13
degesch.c
13
degesch.c
|
@ -107,19 +107,6 @@ static struct config_item g_config_table[] =
|
||||||
// All text stored in our data structures is encoded in UTF-8.
|
// All text stored in our data structures is encoded in UTF-8.
|
||||||
// Or at least should be. The exception is IRC identifiers.
|
// Or at least should be. The exception is IRC identifiers.
|
||||||
|
|
||||||
/// Shorthand to set an error and return failure from the function
|
|
||||||
#define FAIL(...) \
|
|
||||||
BLOCK_START \
|
|
||||||
error_set (e, __VA_ARGS__); \
|
|
||||||
return false; \
|
|
||||||
BLOCK_END
|
|
||||||
|
|
||||||
// A few other debugging shorthands
|
|
||||||
#define LOG_FUNC_FAILURE(name, desc) \
|
|
||||||
print_debug ("%s: %s: %s", __func__, (name), (desc))
|
|
||||||
#define LOG_LIBC_FAILURE(name) \
|
|
||||||
print_debug ("%s: %s: %s", __func__, (name), strerror (errno))
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
// We need a few reference countable objects with support
|
// We need a few reference countable objects with support
|
||||||
|
|
Loading…
Reference in New Issue