#include <stdio.h>
#include <glib.h>
#include <stdint.h>
+#include <stdlib.h>
+#include <errno.h>
#include <babeltrace/compat/string.h>
#define PERROR_BUFLEN 200
#define _bt_printf_perror(fp, fmt, args...) \
({ \
char buf[PERROR_BUFLEN] = "Error in strerror_r()"; \
- compat_strerror_r(errno, buf, sizeof(buf)); \
+ bt_strerror_r(errno, buf, sizeof(buf)); \
_bt_printfe(fp, "error", buf, fmt, ## args); \
})
#define _bt_printfl_perror(fp, lineno, fmt, args...) \
({ \
char buf[PERROR_BUFLEN] = "Error in strerror_r()"; \
- compat_strerror_r(errno, buf, sizeof(buf)); \
+ bt_strerror_r(errno, buf, sizeof(buf)); \
_bt_printfle(fp, "error", lineno, buf, fmt, ## args); \
})
#define max(a, b) (((a) > (b)) ? (a) : (b))
#endif
+#ifndef max_t
+#define max_t(type, a, b) \
+ ((type) (a) > (type) (b) ? (type) (a) : (type) (b))
+#endif
+
+/*
+ * Memory allocation zeroed
+ */
+#define zmalloc(x) calloc(1, x)
+
/*
* BT_HIDDEN: set the hidden attribute for internal functions
*/