Properly play a holdtime message if the announce-holdtime option is
[asterisk-bristuff.git] / include / asterisk / inline_api.h
blob2347d09d7f3b82142ba5925d2b17ed5f458b18ad
1 /*
2 * Asterisk -- An open source telephony toolkit.
4 * Copyright (C) 1999 - 2005, Digium, Inc.
6 * Kevin P. Fleming <kpfleming@digium.com>
8 * See http://www.asterisk.org for more information about
9 * the Asterisk project. Please do not directly contact
10 * any of the maintainers of this project for assistance;
11 * the project provides a web site, mailing lists and IRC
12 * channels for your use.
14 * This program is free software, distributed under the terms of
15 * the GNU General Public License Version 2. See the LICENSE file
16 * at the top of the source tree.
19 #ifndef __ASTERISK_INLINEAPI_H
20 #define __ASTERISK_INLINEAPI_H
22 /*! \file
23 * \brief Inlinable API function macro
25 Small API functions that are candidates for inlining need to be specially
26 declared and defined, to ensure that the 'right thing' always happens.
27 For example:
28 - there must _always_ be a non-inlined version of the function
29 available for modules compiled out of the tree to link to
30 - references to a function that cannot be inlined (for any
31 reason that the compiler deems proper) must devolve into an
32 'extern' reference, instead of 'static', so that multiple
33 copies of the function body are not built in different modules
34 - when LOW_MEMORY is defined, inlining should be disabled
35 completely, even if the compiler is configured to support it
37 The AST_INLINE_API macro allows this to happen automatically, when
38 used to define your function. Proper usage is as follows:
39 - define your function one place, in a header file, using the macro
40 to wrap the function (see strings.h or time.h for examples)
41 - choose a module to 'host' the function body for non-inline
42 usages, and in that module _only_, define AST_API_MODULE before
43 including the header file
46 #if !defined(LOW_MEMORY)
48 #if !defined(AST_API_MODULE)
49 #define AST_INLINE_API(hdr, body) hdr; extern inline hdr body
50 #else
51 #define AST_INLINE_API(hdr, body) hdr; hdr body
52 #endif
54 #else /* defined(LOW_MEMORY) */
56 #if !defined(AST_API_MODULE)
57 #define AST_INLINE_API(hdr, body) hdr;
58 #else
59 #define AST_INLINE_API(hdr, body) hdr; hdr body
60 #endif
62 #endif
64 #undef AST_API_MODULE
66 #endif /* __ASTERISK_INLINEAPI_H */