Heap.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright (c) 2009, 2020 IBM Corp. and others
3  *
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v2.0
6  * and Eclipse Distribution License v1.0 which accompany this distribution.
7  *
8  * The Eclipse Public License is available at
9  * https://www.eclipse.org/legal/epl-2.0/
10  * and the Eclipse Distribution License is available at
11  * http://www.eclipse.org/org/documents/edl-v10.php.
12  *
13  * Contributors:
14  * Ian Craggs - initial API and implementation and/or initial documentation
15  * Ian Craggs - use tree data structure instead of list
16  *******************************************************************************/
17 
18 
19 #if !defined(HEAP_H)
20 #define HEAP_H
21 
22 #if defined(HIGH_PERFORMANCE)
23 #define NO_HEAP_TRACKING 1
24 #endif
25 
26 #define PAHO_MEMORY_ERROR -99
27 
28 #include "MQTTExportDeclarations.h"
29 
30 #include <stdio.h>
31 #include <stdlib.h>
32 
33 #if !defined(NO_HEAP_TRACKING)
34 
35 #if !defined(TREE_C)
36 
41 #define malloc(x) mymalloc(__FILE__, __LINE__, x)
42 
49 #define realloc(a, b) myrealloc(__FILE__, __LINE__, a, b)
50 
55 #define free(x) myfree(__FILE__, __LINE__, x)
56 
57 #endif
58 
62 typedef struct
63 {
64  size_t current_size;
65  size_t max_size;
66 } heap_info;
67 
68 #if defined(__cplusplus)
69  extern "C" {
70 #endif
71 
72 void* mymalloc(char*, int, size_t size);
73 void* myrealloc(char*, int, void* p, size_t size);
74 void myfree(char*, int, void* p);
75 
76 void Heap_scan(FILE* file);
77 int Heap_initialize(void);
78 void Heap_terminate(void);
80 int HeapDump(FILE* file);
81 int HeapDumpString(FILE* file, char* str);
82 void* Heap_findItem(void* p);
83 void Heap_unlink(char* file, int line, void* p);
84 #ifdef __cplusplus
85  }
86 #endif
87 
88 #endif
89 
90 #endif
size_t max_size
Definition: Heap.h:65
#define LIBMQTT_API
void * mymalloc(char *, int, size_t size)
Definition: Heap.c:158
void * myrealloc(char *, int, void *p, size_t size)
Definition: Heap.c:320
void Heap_terminate(void)
Definition: Heap.c:417
int HeapDumpString(FILE *file, char *str)
Definition: Heap.c:443
void myfree(char *, int, void *p)
Definition: Heap.c:277
void Heap_scan(FILE *file)
void * Heap_findItem(void *p)
Definition: Heap.c:368
Definition: Heap.h:62
LIBMQTT_API heap_info * Heap_get_info(void)
Definition: Heap.c:432
void Heap_unlink(char *file, int line, void *p)
Definition: Heap.c:300
size_t current_size
Definition: Heap.h:64
int Heap_initialize(void)
Definition: Heap.c:406
int HeapDump(FILE *file)
Definition: Heap.c:462


plotjuggler
Author(s): Davide Faconti
autogenerated on Sun Dec 6 2020 03:47:35