diff options
author | Vicent Marti <tanoku@gmail.com> | 2011-10-28 15:38:32 -0700 |
---|---|---|
committer | Vicent Marti <tanoku@gmail.com> | 2011-10-28 15:38:32 -0700 |
commit | d78312cddb971477d8008b7b33b0b9e27c8da022 (patch) | |
tree | 5f4f7826fcbbaaa3cc8c832dd4754de76afb5684 /deps/halloc/macros.h | |
parent | 5470aa2507ab77365903ac94e3c3d4898c252fb0 (diff) | |
download | libgit2-halloc.tar.gz |
global: Deploy hallochalloc
Diffstat (limited to 'deps/halloc/macros.h')
-rw-r--r-- | deps/halloc/macros.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/deps/halloc/macros.h b/deps/halloc/macros.h new file mode 100644 index 000000000..0123d4670 --- /dev/null +++ b/deps/halloc/macros.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2004-2010 Alex Pankratov. All rights reserved. + * + * Hierarchical memory allocator, 1.2.1 + * 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_MACROS_H_ +#define _LIBP_MACROS_H_ + +#include <stddef.h> /* offsetof */ + +/* + restore pointer to the structure by a pointer to its field + */ +#define structof(p,t,f) ((t*)(- offsetof(t,f) + (void*)(p))) + +/* + * redefine for the target compiler + */ +#define static_inline static __inline__ + + +#endif + |