diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-12-09 13:15:10 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-12-09 13:15:10 +0100 |
commit | 7a994c9631c590d6a73c842fa5d2d3567b4771dd (patch) | |
tree | 228ade01f99ba217151a0ed20f29c5f3a5028619 /src/libmdsserver/macros.h | |
parent | mds-kbdc: compile-layout: macro_call: fix bug: do not duplicate the arguments if there are none (diff) | |
parent | report an error, rather than causing failure the caller but not for the called function (diff) | |
download | mds-7a994c9631c590d6a73c842fa5d2d3567b4771dd.tar.gz mds-7a994c9631c590d6a73c842fa5d2d3567b4771dd.tar.bz2 mds-7a994c9631c590d6a73c842fa5d2d3567b4771dd.tar.xz |
merge track-errors and resolve conflict
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r-- | src/libmdsserver/macros.h | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/libmdsserver/macros.h b/src/libmdsserver/macros.h index 6c8f944..b72fd0a 100644 --- a/src/libmdsserver/macros.h +++ b/src/libmdsserver/macros.h @@ -399,11 +399,21 @@ /** - * Go to the label `pfail` if a condition is met + * Go to the label `fail` if a condition is met * * @param ... The condition */ -#define fail_if(...) if (__VA_ARGS__) goto pfail +#define fail_if(...) \ + do \ + if (__VA_ARGS__) \ + { \ + int _fail_if_saved_errno = errno; \ + if ((errno != EMSGSIZE) && (errno != ECONNRESET) && (errno != EINTR)) \ + fprintf(stderr, "failure at %s:%i\n", __FILE__, __LINE__); \ + errno = _fail_if_saved_errno; \ + goto fail; \ + } \ + while (0) /** @@ -412,7 +422,7 @@ * @param condition The condition * @param instructions The instruction (semicolon-terminated) */ -#define exit_if(condition, instructions) if (condition) { instructions return 1; } +#define exit_if(condition, instructions) do { if (condition) { instructions return 1; } } while (0) /** |