/*
* Adds the digit separator `sep` as many times as needed to form groups
* of `digits_per_group` digits within `str`. `str` must have enough
- * room to accomodate the new separators, that is:
+ * room to accommodate the new separators, that is:
*
* strlen(str) + (strlen(str) / digits_per_group) + 1
*
void bt_common_abort(void) __attribute__((noreturn));
+#if (!defined(BT_LOG_WRITE_CUR_LVL) && !defined(BT_LOG_WRITE_ERRNO_CUR_LVL))
+#define BT_LOG_LEVEL_UNUSED_ATTR __attribute__((unused))
+#else
+#define BT_LOG_LEVEL_UNUSED_ATTR
+#endif
+
/*
* Wraps read() function to handle EINTR and partial reads.
* On success, it returns `count` received as parameter. On error, it returns a
* value smaller than the requested `count`.
*/
static inline
-ssize_t bt_common_read(int fd, void *buf, size_t count, int log_level)
+ssize_t bt_common_read(int fd, void *buf, size_t count,
+ int log_level BT_LOG_LEVEL_UNUSED_ATTR)
{
size_t i = 0;
ssize_t ret;
/* retry operation */
continue;
} else {
-#ifdef BT_LOG_WRITE_ERRNO_CUR_LVL
- BT_LOG_WRITE_ERRNO_CUR_LVL(BT_LOG_ERROR,
+#ifdef BT_LOG_WRITE_ERRNO_PRINTF_CUR_LVL
+ BT_LOG_WRITE_ERRNO_PRINTF_CUR_LVL(BT_LOG_ERROR,
log_level, BT_LOG_TAG,
"Error while reading", ": fd=%d", fd);
#endif