2 * SPDX-License-Identifier: MIT
4 * Copyright 2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 #ifndef _BABELTRACE_INTERNAL_H
8 #define _BABELTRACE_INTERNAL_H
10 #define bt_max_t(type, a, b) \
11 ((type) (a) > (type) (b) ? (type) (a) : (type) (b))
14 * BT_HIDDEN: set the hidden attribute for internal functions
15 * On Windows, symbols are local unless explicitly exported,
16 * see https://gcc.gnu.org/wiki/Visibility
18 #if defined(_WIN32) || defined(__CYGWIN__)
21 #define BT_HIDDEN __attribute__((visibility("hidden")))
25 * Yield `ref`'s value while setting `ref` to NULL.
27 * This can be used to give a strong reference to a callee:
29 * add_foo_to_list(list, BT_MOVE_REF(foo));
31 * or in a simple assignment:
33 * my_struct->foo = BT_MOVE_REF(foo);
35 * When moving a reference in a function call, the reference is given to the
36 * callee even if that function call fails, so make sure the called function
37 * is written accordingly.
40 #define BT_MOVE_REF(ref) \
42 typeof(ref) _ref = ref; \
This page took 0.030152 seconds and 4 git commands to generate.