From cd89db5c2f9860197fa2708929bb46f25726d6e3 Mon Sep 17 00:00:00 2001
From: Deomid Ryabkov <rojer@cesanta.com>
Date: Wed, 7 Feb 2018 13:58:31 +0000
Subject: [PATCH] Add a convenience macro invoke subroutines

To properly fail a test in a subroutine, return value needs to be passed up.
This snippet makes it short.

PUBLISHED_FROM=2f6328b5eb2921a4caa53d8887c02f73a5d817ea
---
 src/common/test_util.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/common/test_util.h b/src/common/test_util.h
index 4a2439fe1..33007e07f 100644
--- a/src/common/test_util.h
+++ b/src/common/test_util.h
@@ -165,6 +165,12 @@ void _strfail(const char *a, const char *e, int len);
     }                                                                \
   } while (0)
 
+#define CHECK_CALL(call)     \
+  do {                       \
+    const char *r = (call);  \
+    if (r != NULL) return r; \
+  } while (0)
+
 #ifndef MG_ENABLE_POLL_UNTIL
 #define MG_ENABLE_POLL_UNTIL 0
 #endif
-- 
GitLab