X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon%2Fmacros.h;h=308d3d57a14d5ff9ad7911383af9f40f0477c4da;hb=847a5916c26ab9cc0dfc9322cccd2c748c54747e;hp=8185c85abfdacdece8bd4442cc10ca2898b8bd32;hpb=d14d33bf091e72b23b1f90ea18a0a01bed098b76;p=lttng-tools.git diff --git a/src/common/macros.h b/src/common/macros.h index 8185c85ab..308d3d57a 100644 --- a/src/common/macros.h +++ b/src/common/macros.h @@ -46,10 +46,34 @@ /* * Memory allocation zeroed */ -#define zmalloc(x) calloc(1, x) +static inline +void *zmalloc(size_t len) +{ + return calloc(1, len); +} #ifndef ARRAY_SIZE #define ARRAY_SIZE(array) (sizeof(array) / (sizeof((array)[0]))) #endif +#ifndef max +#define max(a, b) ((a) > (b) ? (a) : (b)) +#endif + +#ifndef max_t +#define max_t(type, a, b) ((type) max(a, b)) +#endif + +#ifndef min +#define min(a, b) ((a) < (b) ? (a) : (b)) +#endif + +#ifndef LTTNG_PACKED +#define LTTNG_PACKED __attribute__((__packed__)) +#endif + +#ifndef LTTNG_HIDDEN +#define LTTNG_HIDDEN __attribute__((visibility("hidden"))) +#endif + #endif /* _MACROS_H */