-
Notifications
You must be signed in to change notification settings - Fork 4
/
halloc.h
43 lines (34 loc) · 875 Bytes
/
halloc.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
* This file is a part of Hierarchical Allocator library.
* Copyright (c) 2004-2011 Alex Pankratov. All rights reserved.
*
* http://swapped.cc/halloc
*/
/*
* The program is distributed under terms of BSD license.
* You can obtain the copy of the license by visiting:
*
* http://www.opensource.org/licenses/bsd-license.php
*/
#ifndef _LIBP_HALLOC_H_
#define _LIBP_HALLOC_H_
#include <stddef.h> /* size_t */
/*
* Core API
*/
void * halloc (void * block, size_t len);
void hattach(void * block, void * parent);
/*
* standard malloc/free api
*/
void * h_malloc (size_t len);
void * h_calloc (size_t n, size_t len);
void * h_realloc(void * p, size_t len);
void h_free (void * p);
char * h_strdup (const char * str);
/*
* the underlying allocator
*/
typedef void * (* realloc_t)(void * ptr, size_t len);
extern realloc_t halloc_allocator;
#endif