+/**
+ * Check a condition or return.
+ *
+ * If the condition is true, do nothing. If it is false, set
+ * errno and return the specified value.
+ *
+ * @param cond
+ * The condition to test.
+ * @param ret
+ * The value to return.
+ * @param err
+ * The errno to set.
+ */
+#define EC_CHECK_ARG(cond, ret, err) do { \
+ if (!(cond)) { \
+ errno = err; \
+ return ret; \
+ } \
+ } while(0)
+