vfprintf(stderr, fmt, argp); \
va_end(argp); \
}
+/**
+ * Define the standard log function and activate it.
+ *
+ * \param loglevel_barrier See \ref DEFINE_STDERR_LOGGER.
+ */
#define INIT_STDERR_LOGGING(loglevel_barrier) \
DEFINE_STDERR_LOGGER(stderr_log, loglevel_barrier); \
__printf_2_3 void (*para_log)(int, const char*, ...) = stderr_log;
return ((max + 0.0) * (random() / (RAND_MAX + 1.0)));
}
+/**
+ * Simple sanity check for I/O vectors.
+ *
+ * \param iov Pointer to the I/O vector to check.
+ *
+ * \return True if \a iov points to a non-empty buffer.
+ */
+_static_inline_ bool iov_valid(const struct iovec *iov)
+{
+ return iov && iov->iov_len > 0 && iov->iov_base;
+}
+
/** Round up x to next multiple of y. */
#define ROUND_UP(x, y) ({ \
const typeof(y) _divisor = y; \