X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon%2Fmacros.h;h=8ae6535d0de57ed1878bf42b98d37163fadccb49;hb=1f3c3a24e3a07f6fd032ad50bac92f1f58d33a12;hp=9304388554d0af82e61ab6ae2e0abddca933960d;hpb=f6835b82a8dbb3a9688c7b28fd4d673dca371272;p=lttng-tools.git diff --git a/src/common/macros.h b/src/common/macros.h index 930438855..8ae6535d0 100644 --- a/src/common/macros.h +++ b/src/common/macros.h @@ -21,6 +21,7 @@ #include #include +#include /* * Takes a pointer x and transform it so we can use it to access members @@ -77,6 +78,8 @@ void *zmalloc(size_t len) #define LTTNG_HIDDEN __attribute__((visibility("hidden"))) #endif +#define member_sizeof(type, field) sizeof(((type *) 0)->field) + /* * lttng_strncpy returns 0 on success, or nonzero on failure. * It checks that the @src string fits into @dst_len before performing @@ -87,7 +90,7 @@ void *zmalloc(size_t len) static inline int lttng_strncpy(char *dst, const char *src, size_t dst_len) { - if (strnlen(src, dst_len) == dst_len) { + if (lttng_strnlen(src, dst_len) == dst_len) { /* Fail since copying would result in truncation. */ return -1; }