X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=git-compat-util.h;h=4cc2c8283ac91d75bc23096b9f3cdfc00c391743;hb=973d5eea7455e1053842f7474c8ec34755f3525b;hp=cc0e7e97334ec90a355f9c8eb088c6810a91193c;hpb=7a779ca2f89a33f405029ac30891cec769b08d2e;p=thirdparty%2Fgit.git diff --git a/git-compat-util.h b/git-compat-util.h index cc0e7e9733..4cc2c8283a 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -1,6 +1,15 @@ #ifndef GIT_COMPAT_UTIL_H #define GIT_COMPAT_UTIL_H +#ifdef USE_MSVC_CRTDBG +/* + * For these to work they must appear very early in each + * file -- before most of the standard header files. + */ +#include +#include +#endif + #define _FILE_OFFSET_BITS 64 @@ -1303,4 +1312,14 @@ void unleak_memory(const void *ptr, size_t len); */ #include "banned.h" +/* + * container_of - Get the address of an object containing a field. + * + * @ptr: pointer to the field. + * @type: type of the object. + * @member: name of the field within the object. + */ +#define container_of(ptr, type, member) \ + ((type *) ((char *)(ptr) - offsetof(type, member))) + #endif