]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/systemd/_sd-common.h
core: when booting up, initialize hostname to compile-time fallback hostname
[thirdparty/systemd.git] / src / systemd / _sd-common.h
CommitLineData
aacf3b48
LP
1#ifndef foosdcommonhfoo
2#define foosdcommonhfoo
3
4/***
5 This file is part of systemd.
6
7 Copyright 2013 Lennart Poettering
8
9 systemd is free software; you can redistribute it and/or modify it
10 under the terms of the GNU Lesser General Public License as published by
11 the Free Software Foundation; either version 2.1 of the License, or
12 (at your option) any later version.
13
14 systemd is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License for more details.
18
19 You should have received a copy of the GNU Lesser General Public License
20 along with systemd; If not, see <http://www.gnu.org/licenses/>.
21***/
22
10b17992 23/* This is a private header; never even think of including this directly! */
aacf3b48 24
fd1b903a 25#if __INCLUDE_LEVEL__ <= 1
10b17992 26#error "Do not include _sd-common.h directly; it is a private header."
fd1b903a
LP
27#endif
28
aacf3b48
LP
29#ifndef _sd_printf_
30# if __GNUC__ >= 4
31# define _sd_printf_(a,b) __attribute__ ((format (printf, a, b)))
32# else
33# define _sd_printf_(a,b)
34# endif
35#endif
36
37#ifndef _sd_sentinel_
38# define _sd_sentinel_ __attribute__((sentinel))
39#endif
40
41#ifndef _sd_packed_
42# define _sd_packed_ __attribute__((packed))
43#endif
44
98f91566
LP
45#ifndef _sd_pure_
46# define _sd_pure_ __attribute__((pure))
47#endif
48
0095c454
LP
49#ifndef _SD_STRINGIFY
50# define _SD_XSTRINGIFY(x) #x
51# define _SD_STRINGIFY(x) _SD_XSTRINGIFY(x)
52#endif
53
54#ifndef _SD_BEGIN_DECLARATIONS
55# ifdef __cplusplus
56# define _SD_BEGIN_DECLARATIONS \
57 extern "C" { \
20ba6c2e 58 struct _sd_useless_struct_to_allow_trailing_semicolon_
0095c454
LP
59# else
60# define _SD_BEGIN_DECLARATIONS \
20ba6c2e 61 struct _sd_useless_struct_to_allow_trailing_semicolon_
0095c454
LP
62# endif
63#endif
64
65#ifndef _SD_END_DECLARATIONS
66# ifdef __cplusplus
67# define _SD_END_DECLARATIONS \
68 } \
20ba6c2e 69 struct _sd_useless_cpp_struct_to_allow_trailing_semicolon_
0095c454
LP
70# else
71# define _SD_END_DECLARATIONS \
20ba6c2e 72 struct _sd_useless_struct_to_allow_trailing_semicolon_
0095c454 73# endif
aacf3b48
LP
74#endif
75
4afd3348 76#define _SD_DEFINE_POINTER_CLEANUP_FUNC(type, func) \
0cb27225 77 static __inline__ void func##p(type **p) { \
4afd3348
LP
78 if (*p) \
79 func(*p); \
80 } \
20ba6c2e 81 struct _sd_useless_struct_to_allow_trailing_semicolon_
4afd3348 82
aacf3b48 83#endif