]> granicus.if.org Git - graphviz/commitdiff
Removed redefinitions of `offsetof`
authorErwin Janssen <erwinjanssen@outlook.com>
Tue, 20 Sep 2016 11:09:17 +0000 (13:09 +0200)
committerErwin Janssen <erwinjanssen@outlook.com>
Tue, 4 Oct 2016 14:06:45 +0000 (16:06 +0200)
The `offsetof` macro is part of the ANSI C standard, so redefining it is
not needed since it's always present.

lib/cdt/cdt.h
lib/cgraph/cghdr.h
lib/fdpgen/grid.c

index 6dc99e5dab61cac92f0cec9a2a3d14aec3a23229..8156010cc1b558d90b7167011234ccb65dc94e61 100644 (file)
@@ -99,12 +99,6 @@ struct _dtdisc_s
          (dc)->comparf = (cmpf), (dc)->hashf = (hshf), \
          (dc)->memoryf = (memf), (dc)->eventf = (evf) )
 
-#ifdef offsetof
-#define DTOFFSET(struct_s, member)     offsetof(struct_s, member)
-#else
-#define DTOFFSET(struct_s, member)     ((int)(&((struct_s*)0)->member))
-#endif
-
 /* the dictionary structure itself */
 struct _dt_s
 {      Dtsearch_f      searchf;/* search function                      */
index 940337e34b5ee2d504e0450c83b6553e0c625336..84c7282440832f086b5fe8ab2e412f761c54848d 100644 (file)
 #ifndef streq
 #define streq(s,t)             ((*s == *t) && !strcmp((s),(t)))
 #endif
-#ifdef offsetof
-#undef offsetof
-#endif
-#ifdef HAVE_INTPTR_T
-#define offsetof(typ,fld)  ((intptr_t)(&(((typ*)0)->fld)))
-#else
-#define offsetof(typ,fld)  ((int)(&(((typ*)0)->fld)))
-#endif
 #define NOTUSED(var)   (void) var
 
 #define NILgraph                       NIL(Agraph_t*)
index 2b3a937d5eadda8bdf606c930deb6c8cbb7db1d9..639b3694be90d7c77321b49123010034dfd67bda 100644 (file)
@@ -94,11 +94,6 @@ static cell *getCell(Grid * g)
     return cp;
 }
 
-#ifndef offsetof
-#define offsetof(typ,fld)  ((int)(&(((typ*)0)->fld)))
-#endif
-
-
 static int ijcmpf(Dt_t * d, gridpt * p1, gridpt * p2, Dtdisc_t * disc)
 {
     int diff;