1 #ifndef _BABELTRACE_INTERNAL_H
2 #define _BABELTRACE_INTERNAL_H
5 * babeltrace/babeltrace-internal.h
7 * Copyright 2012 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 * Permission is hereby granted, free of charge, to any person obtaining a copy
10 * of this software and associated documentation files (the "Software"), to deal
11 * in the Software without restriction, including without limitation the rights
12 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 * copies of the Software, and to permit persons to whom the Software is
14 * furnished to do so, subject to the following conditions:
16 * The above copyright notice and this permission notice shall be included in
17 * all copies or substantial portions of the Software.
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32 #include <babeltrace/compat/string-internal.h>
33 #include <babeltrace/types.h>
35 #define PERROR_BUFLEN 200
39 # define likely(x) __builtin_expect(!!(x), 1)
41 # define likely(x) (!!(x))
47 # define unlikely(x) __builtin_expect(!!(x), 0)
49 # define unlikely(x) (!!(x))
54 #define min(a, b) (((a) < (b)) ? (a) : (b))
58 #define max(a, b) (((a) > (b)) ? (a) : (b))
62 #define max_t(type, a, b) \
63 ((type) (a) > (type) (b) ? (type) (a) : (type) (b))
67 * Memory allocation zeroed
69 #define zmalloc(x) calloc(1, x)
72 * BT_HIDDEN: set the hidden attribute for internal functions
73 * On Windows, symbols are local unless explicitly exported,
74 * see https://gcc.gnu.org/wiki/Visibility
76 #if defined(_WIN32) || defined(__CYGWIN__)
79 #define BT_HIDDEN __attribute__((visibility("hidden")))
83 #define __STRINGIFY(x) #x
86 #define TOSTRING(x) __STRINGIFY(x)
88 #define BT_UNUSED __attribute__((unused))
This page took 0.048723 seconds and 4 git commands to generate.