1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/media/libnestegg/src/macros.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,36 @@ 1.4 +/* 1.5 + * Copyright (c) 2004-2010 Alex Pankratov. All rights reserved. 1.6 + * 1.7 + * Hierarchical memory allocator, 1.2.1 1.8 + * http://swapped.cc/halloc 1.9 + */ 1.10 + 1.11 +/* 1.12 + * The program is distributed under terms of BSD license. 1.13 + * You can obtain the copy of the license by visiting: 1.14 + * 1.15 + * http://www.opensource.org/licenses/bsd-license.php 1.16 + */ 1.17 + 1.18 +#ifndef _LIBP_MACROS_H_ 1.19 +#define _LIBP_MACROS_H_ 1.20 + 1.21 +#include <stddef.h> /* offsetof */ 1.22 + 1.23 +/* 1.24 + restore pointer to the structure by a pointer to its field 1.25 + */ 1.26 +#define structof(p,t,f) ((t*)(- (ptrdiff_t) offsetof(t,f) + (char*)(p))) 1.27 + 1.28 +/* 1.29 + * redefine for the target compiler 1.30 + */ 1.31 +#ifdef _WIN32 1.32 +#define static_inline static __inline 1.33 +#else 1.34 +#define static_inline static __inline__ 1.35 +#endif 1.36 + 1.37 + 1.38 +#endif 1.39 +