X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flibpspp%2Fhmap.h;h=c9e764dec563a92df08491839259e5f061884963;hb=ece48101c54930c528980a980ee070d9c77971c2;hp=e73d84fd153764ec96935c6242dc2388820c5757;hpb=015e221b0f8578afee769528572c76387f26c629;p=pspp diff --git a/src/libpspp/hmap.h b/src/libpspp/hmap.h index e73d84fd15..c9e764dec5 100644 --- a/src/libpspp/hmap.h +++ b/src/libpspp/hmap.h @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008, 2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -116,12 +116,14 @@ */ #include +#include /* Returns the data structure corresponding to the given NODE, assuming that NODE is embedded as the given MEMBER name in data type STRUCT. NODE must not be a null pointer. */ #define HMAP_DATA(NODE, STRUCT, MEMBER) \ - ((STRUCT *) ((char *) (NODE) - offsetof (STRUCT, MEMBER))) + (CHECK_POINTER_HAS_TYPE (NODE, struct hmap_node *), \ + UP_CAST (NODE, STRUCT, MEMBER)) /* Like HMAP_DATA, except that a null NODE yields a null pointer result. */