michael@0: /* michael@0: * Copyright (c) 2004-2010 Alex Pankratov. All rights reserved. michael@0: * michael@0: * Hierarchical memory allocator, 1.2.1 michael@0: * http://swapped.cc/halloc michael@0: */ michael@0: michael@0: /* michael@0: * The program is distributed under terms of BSD license. michael@0: * You can obtain the copy of the license by visiting: michael@0: * michael@0: * http://www.opensource.org/licenses/bsd-license.php michael@0: */ michael@0: michael@0: #ifndef _LIBP_HALLOC_H_ michael@0: #define _LIBP_HALLOC_H_ michael@0: michael@0: #include /* size_t */ michael@0: michael@0: /* michael@0: * Core API michael@0: */ michael@0: void * halloc (void * block, size_t len); michael@0: void hattach(void * block, void * parent); michael@0: michael@0: /* michael@0: * standard malloc/free api michael@0: */ michael@0: void * h_malloc (size_t len); michael@0: void * h_calloc (size_t n, size_t len); michael@0: void * h_realloc(void * p, size_t len); michael@0: void h_free (void * p); michael@0: char * h_strdup (const char * str); michael@0: michael@0: /* michael@0: * the underlying allocator michael@0: */ michael@0: typedef void * (* realloc_t)(void * ptr, size_t len); michael@0: michael@0: extern realloc_t halloc_allocator; michael@0: michael@0: #endif michael@0: