|
@@ -268,49 +268,68 @@ LSUP_strerror (LSUP_rc rc);
|
|
*/
|
|
*/
|
|
#define LOG_RC(rc) do { \
|
|
#define LOG_RC(rc) do { \
|
|
if ((rc) < 0) log_error (LSUP_strerror (rc)); \
|
|
if ((rc) < 0) log_error (LSUP_strerror (rc)); \
|
|
- else if ((rc) > 0) LOG_DEBUG(LSUP_strerror (rc)); \
|
|
|
|
|
|
+ else if ((rc) > 0) LOG_DEBUG (LSUP_strerror (rc)); \
|
|
} while (0);
|
|
} while (0);
|
|
|
|
|
|
/// Jump to `marker` if `exp` does not return `LSUP_OK`.
|
|
/// Jump to `marker` if `exp` does not return `LSUP_OK`.
|
|
#define CHECK(exp, marker) do { \
|
|
#define CHECK(exp, marker) do { \
|
|
LSUP_rc _rc = (exp); \
|
|
LSUP_rc _rc = (exp); \
|
|
LOG_RC(_rc); \
|
|
LOG_RC(_rc); \
|
|
- if (UNLIKELY (_rc != LSUP_OK)) goto marker; \
|
|
|
|
|
|
+ if (UNLIKELY (_rc != LSUP_OK)) { \
|
|
|
|
+ log_error ("*** PREMATURE EXIT due to error:"); \
|
|
|
|
+ LOG_RC(_rc); \
|
|
|
|
+ goto marker; \
|
|
|
|
+ } \
|
|
} while (0);
|
|
} while (0);
|
|
|
|
|
|
/// Jump to `marker` if `exp` returns a negative value (skip warnings).
|
|
/// Jump to `marker` if `exp` returns a negative value (skip warnings).
|
|
#define PCHECK(exp, marker) do { \
|
|
#define PCHECK(exp, marker) do { \
|
|
LSUP_rc _rc = (exp); \
|
|
LSUP_rc _rc = (exp); \
|
|
- LOG_RC(_rc); \
|
|
|
|
- if (UNLIKELY (_rc < LSUP_OK)) goto marker; \
|
|
|
|
|
|
+ if (UNLIKELY (_rc < LSUP_OK)) { \
|
|
|
|
+ log_error ("*** PREMATURE EXIT due to error:"); \
|
|
|
|
+ LOG_RC(_rc); \
|
|
|
|
+ goto marker; \
|
|
|
|
+ } \
|
|
} while (0);
|
|
} while (0);
|
|
|
|
|
|
/// Return `exp` return value if it is of `LSUP_rc` type and nonzero.
|
|
/// Return `exp` return value if it is of `LSUP_rc` type and nonzero.
|
|
#define RCCK(exp) do { \
|
|
#define RCCK(exp) do { \
|
|
LSUP_rc _rc = (exp); \
|
|
LSUP_rc _rc = (exp); \
|
|
- LOG_RC(_rc); \
|
|
|
|
- if (UNLIKELY (_rc != LSUP_OK)) return _rc; \
|
|
|
|
|
|
+ if (UNLIKELY (_rc != LSUP_OK)) { \
|
|
|
|
+ log_error ("*** PREMATURE EXIT due to error:"); \
|
|
|
|
+ LOG_RC(_rc); \
|
|
|
|
+ return _rc; \
|
|
|
|
+ } \
|
|
} while (0);
|
|
} while (0);
|
|
|
|
|
|
/// Return `exp` return value if it is of `LSUP_rc` type and negative (=error)
|
|
/// Return `exp` return value if it is of `LSUP_rc` type and negative (=error)
|
|
-#define PRCCK(exp) do { \
|
|
|
|
|
|
+#define PRCCK(exp) do { \
|
|
LSUP_rc _rc = (exp); \
|
|
LSUP_rc _rc = (exp); \
|
|
- LOG_RC(_rc); \
|
|
|
|
- if (UNLIKELY (_rc < LSUP_OK)) return _rc; \
|
|
|
|
|
|
+ if (UNLIKELY (_rc < LSUP_OK)) { \
|
|
|
|
+ log_error ("*** PREMATURE EXIT due to error:"); \
|
|
|
|
+ LOG_RC(_rc); \
|
|
|
|
+ return _rc; \
|
|
|
|
+ } \
|
|
} while (0);
|
|
} while (0);
|
|
|
|
|
|
/// Return `NULL` if `exp` returns a nonzero value.
|
|
/// Return `NULL` if `exp` returns a nonzero value.
|
|
#define RCNL(exp) do { \
|
|
#define RCNL(exp) do { \
|
|
LSUP_rc _rc = (exp); \
|
|
LSUP_rc _rc = (exp); \
|
|
- LOG_RC(_rc); \
|
|
|
|
- if (UNLIKELY (_rc != LSUP_OK)) return NULL; \
|
|
|
|
|
|
+ if (UNLIKELY (_rc != LSUP_OK)) { \
|
|
|
|
+ log_error ("*** PREMATURE EXIT due to error:"); \
|
|
|
|
+ LOG_RC(_rc); \
|
|
|
|
+ return NULL; \
|
|
|
|
+ } \
|
|
} while (0);
|
|
} while (0);
|
|
|
|
|
|
/// Return NULL if `exp` returns a negative value (=error)
|
|
/// Return NULL if `exp` returns a negative value (=error)
|
|
-#define PRCNL(exp) do { \
|
|
|
|
|
|
+#define PRCNL(exp) do { \
|
|
LSUP_rc _rc = (exp); \
|
|
LSUP_rc _rc = (exp); \
|
|
- LOG_RC(_rc); \
|
|
|
|
- if (UNLIKELY (_rc < LSUP_OK)) return NULL; \
|
|
|
|
|
|
+ if (UNLIKELY (_rc < LSUP_OK)) { \
|
|
|
|
+ log_error ("*** PREMATURE EXIT due to error:"); \
|
|
|
|
+ LOG_RC(_rc); \
|
|
|
|
+ return NULL; \
|
|
|
|
+ } \
|
|
} while (0);
|
|
} while (0);
|
|
|
|
|
|
/// Allocate one pointer with malloc and return rc if it fails.
|
|
/// Allocate one pointer with malloc and return rc if it fails.
|