client-c  0.7.0
kaa_mem.h
Go to the documentation of this file.
1 /*
2  * Copyright 2014 CyberVision, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef KAA_MEM_H_
18 #define KAA_MEM_H_
19 
20 #include "../platform/mem.h"
21 
22 #ifdef KAA_TRACE_MEMORY_ALLOCATIONS
23 
24 #include "../utilities/kaa_log.h"
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 
30 void * kaa_trace_memory_allocs_malloc(size_t s, const char *file, int line);
31 void * kaa_trace_memory_allocs_calloc(size_t n, size_t s, const char *file, int line);
32 void kaa_trace_memory_allocs_free(void * p, const char *file, int line);
33 void kaa_trace_memory_allocs_set_logger(kaa_logger_t *logger);
34 
35 #define KAA_MALLOC(S) kaa_trace_memory_allocs_malloc(S, __FILE__, __LINE__)
36 #define KAA_CALLOC(N,S) kaa_trace_memory_allocs_calloc((N), (S), __FILE__, __LINE__)
37 #define KAA_FREE(P) kaa_trace_memory_allocs_free((P), __FILE__, __LINE__)
38 
39 #ifdef __cplusplus
40 } // extern "C"
41 #endif
42 
43 #else // defined KAA_TRACE_MEMORY_ALLOCATIONS
44 
45 
46 #define KAA_MALLOC(S) __KAA_MALLOC(S)
47 #define KAA_CALLOC(N,S) __KAA_CALLOC(N,S)
48 #define KAA_FREE(P) __KAA_FREE(P)
49 
50 
51 #endif // defined KAA_TRACE_MEMORY_ALLOCATIONS
52 
53 #endif /* KAA_MEM_H_ */
struct kaa_logger_t kaa_logger_t
Definition: kaa_context.h:81