1 /*
2 Copyright (C) 2015-2021, Dirk Krause
3 SPDX-License-Identifier: BSD-3-Clause
4 */
5 
6 /*
7 	WARNING: This file was generated by the dkct program (see
8 	http://dktools.sourceforge.net/ for details).
9 	Changes you make here will be lost if dkct is run again!
10 	You should modify the original source and run dkct on it.
11 	Original source: dk4mema.ctr
12 */
13 
14 #ifndef DK4MEMA_H_INCLUDED
15 /** Avoid multiple inclusions. */
16 #define DK4MEMA_H_INCLUDED 1
17 
18 
19 /**	@file
20 	Memory allocation with included
21 	diagnostics.
22 */
23 
24 #ifndef DK4CONF_H_INCLUDED
25 #if DK4_BUILDING_DKTOOLS4
26 #include "dk4conf.h"
27 #else
28 #include <dktools-4/dk4conf.h>
29 #endif
30 #endif
31 
32 #ifndef DK4TYPES_H_INCLUDED
33 #if DK4_BUILDING_DKTOOLS4
34 #include <libdk4base/dk4types.h>
35 #else
36 #include <dktools-4/dk4types.h>
37 #endif
38 #endif
39 
40 #ifndef DK4APP_H_INCLUDED
41 #if DK4_BUILDING_DKTOOLS4
42 #include <libdk4app/dk4app.h>
43 #else
44 #include <dktools-4/dk4app.h>
45 #endif
46 #endif
47 
48 
49 
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53 
54 /**	Allocate and initialize memory.
55 	@param	elsize	Element size.
56 	@param	nelem	Number of elements.
57 	@param	app	Application structure for diagnostics, may be NULL.
58 	@return	Pointer to new memory on success, NULL on error.
59 */
60 void *
61 dk4mem_calloc_app(size_t elsize, size_t nelem, dk4_app_t *app);
62 
63 #ifdef __cplusplus
64 }
65 #endif
66 
67 
68 
69 /**	Allocate and initialize memory.
70 	@param	tp	Type to allocate.
71 	@param	ne	Number of elements to allocate.
72 	@param	app	Application structure for diagnostics, may be NULL.
73 	@return	Pointer to a new tp on success, NULL on error.
74 */
75 #define	dk4mem_new_app(tp,ne,app) (tp *)dk4mem_calloc_app(sizeof(tp),ne,app)
76 
77 
78 
79 
80 #endif
81