|
202 | 202 | #error Bad configuration: MLD_CONFIG_CUSTOM_ALLOC_FREE must be set together with MLD_CUSTOM_ALLOC and MLD_CUSTOM_FREE |
203 | 203 | #endif |
204 | 204 |
|
205 | | -/* |
206 | | - * If the integration wants to provide a context parameter for use in |
207 | | - * platform-specific hooks, then it should define this parameter. |
208 | | - * |
209 | | - * The MLD_CONTEXT_PARAMETERS_n macros are intended to be used with macros |
210 | | - * defining the function names and expand to either pass or discard the context |
211 | | - * argument as required by the current build. If there is no context parameter |
212 | | - * requested then these are removed from the prototypes and from all calls. |
213 | | - */ |
214 | | -#ifdef MLD_CONFIG_CONTEXT_PARAMETER |
215 | | -#define MLD_CONTEXT_PARAMETERS_0(context) (context) |
216 | | -#define MLD_CONTEXT_PARAMETERS_1(arg0, context) (arg0, context) |
217 | | -#define MLD_CONTEXT_PARAMETERS_2(arg0, arg1, context) (arg0, arg1, context) |
218 | | -#define MLD_CONTEXT_PARAMETERS_3(arg0, arg1, arg2, context) \ |
219 | | - (arg0, arg1, arg2, context) |
220 | | -#define MLD_CONTEXT_PARAMETERS_4(arg0, arg1, arg2, arg3, context) \ |
221 | | - (arg0, arg1, arg2, arg3, context) |
222 | | -#define MLD_CONTEXT_PARAMETERS_5(arg0, arg1, arg2, arg3, arg4, context) \ |
223 | | - (arg0, arg1, arg2, arg3, arg4, context) |
224 | | -#define MLD_CONTEXT_PARAMETERS_6(arg0, arg1, arg2, arg3, arg4, arg5, context) \ |
225 | | - (arg0, arg1, arg2, arg3, arg4, arg5, context) |
226 | | -#define MLD_CONTEXT_PARAMETERS_7(arg0, arg1, arg2, arg3, arg4, arg5, arg6, \ |
227 | | - context) \ |
228 | | - (arg0, arg1, arg2, arg3, arg4, arg5, arg6, context) |
229 | | -#define MLD_CONTEXT_PARAMETERS_8(arg0, arg1, arg2, arg3, arg4, arg5, arg6, \ |
230 | | - arg7, context) \ |
231 | | - (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, context) |
232 | | -#define MLD_CONTEXT_PARAMETERS_9(arg0, arg1, arg2, arg3, arg4, arg5, arg6, \ |
233 | | - arg7, arg8, context) \ |
234 | | - (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, context) |
235 | | -#else /* MLD_CONFIG_CONTEXT_PARAMETER */ |
236 | | -#define MLD_CONTEXT_PARAMETERS_0(context) () |
237 | | -#define MLD_CONTEXT_PARAMETERS_1(arg0, context) (arg0) |
238 | | -#define MLD_CONTEXT_PARAMETERS_2(arg0, arg1, context) (arg0, arg1) |
239 | | -#define MLD_CONTEXT_PARAMETERS_3(arg0, arg1, arg2, context) (arg0, arg1, arg2) |
240 | | -#define MLD_CONTEXT_PARAMETERS_4(arg0, arg1, arg2, arg3, context) \ |
241 | | - (arg0, arg1, arg2, arg3) |
242 | | -#define MLD_CONTEXT_PARAMETERS_5(arg0, arg1, arg2, arg3, arg4, context) \ |
243 | | - (arg0, arg1, arg2, arg3, arg4) |
244 | | -#define MLD_CONTEXT_PARAMETERS_6(arg0, arg1, arg2, arg3, arg4, arg5, context) \ |
245 | | - (arg0, arg1, arg2, arg3, arg4, arg5) |
246 | | -#define MLD_CONTEXT_PARAMETERS_7(arg0, arg1, arg2, arg3, arg4, arg5, arg6, \ |
247 | | - context) \ |
248 | | - (arg0, arg1, arg2, arg3, arg4, arg5, arg6) |
249 | | -#define MLD_CONTEXT_PARAMETERS_8(arg0, arg1, arg2, arg3, arg4, arg5, arg6, \ |
250 | | - arg7, context) \ |
251 | | - (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) |
252 | | -#define MLD_CONTEXT_PARAMETERS_9(arg0, arg1, arg2, arg3, arg4, arg5, arg6, \ |
253 | | - arg7, arg8, context) \ |
254 | | - (arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) |
255 | | -#endif /* !MLD_CONFIG_CONTEXT_PARAMETER */ |
256 | | - |
257 | | -#if defined(MLD_CONFIG_CONTEXT_PARAMETER_TYPE) != \ |
258 | | - defined(MLD_CONFIG_CONTEXT_PARAMETER) |
259 | | -#error MLD_CONFIG_CONTEXT_PARAMETER_TYPE must be defined if and only if MLD_CONFIG_CONTEXT_PARAMETER is defined |
260 | | -#endif |
| 205 | +/* Context-parameter machinery (MLD_CONTEXT_PARAMETERS_n and related config |
| 206 | + * checks). Kept in a separate, level-generic header for readability; included |
| 207 | + * here so it is available to the allocation macros below and to all consumers |
| 208 | + * of common.h. */ |
| 209 | +#include "context.h" |
261 | 210 |
|
262 | 211 | #if !defined(MLD_CONFIG_CUSTOM_ALLOC_FREE) |
263 | 212 | /* Default: stack allocation */ |
|
0 commit comments