X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Fcommon%2Fmacros.h;h=6a3e061d5f17464222d85701e96a0cbf6e871121;hb=HEAD;hp=8120515c63fe5bbcd81672f8c7b4cf1df89d9ce8;hpb=1c5ea5eb3a9adbc3adc4a3a36a6cf09f7fa05bf1;p=babeltrace.git diff --git a/src/common/macros.h b/src/common/macros.h index 8120515c..8a518b03 100644 --- a/src/common/macros.h +++ b/src/common/macros.h @@ -4,8 +4,8 @@ * Copyright 2012 Mathieu Desnoyers */ -#ifndef _BABELTRACE_INTERNAL_H -#define _BABELTRACE_INTERNAL_H +#ifndef BABELTRACE_COMMON_MACROS_H +#define BABELTRACE_COMMON_MACROS_H #ifdef __cplusplus extern "C" { @@ -45,29 +45,6 @@ extern "C" { #define BT_IF_DEV_MODE(txt) #endif -/* - * Yield `ref`'s value while setting `ref` to NULL. - * - * This can be used to give a strong reference to a callee: - * - * add_foo_to_list(list, BT_MOVE_REF(foo)); - * - * or in a simple assignment: - * - * my_struct->foo = BT_MOVE_REF(foo); - * - * When moving a reference in a function call, the reference is given to the - * callee even if that function call fails, so make sure the called function - * is written accordingly. - */ - -#define BT_MOVE_REF(ref) \ - ({ \ - __typeof__(ref) _ref = ref; \ - ref = NULL; \ - _ref; \ - }) - /* Wrapper for g_array_index that adds bound checking. */ #define bt_g_array_index(a, t, i) \ g_array_index((a), t, ({ BT_ASSERT_DBG((i) < (a)->len); (i); })) @@ -119,4 +96,4 @@ extern "C" { } #endif -#endif +#endif /* BABELTRACE_COMMON_MACROS_H */