]> granicus.if.org Git - php/commitdiff
Fix #79172: STRUCT_OFFSET() relies on undefined behavior
authorChristoph M. Becker <cmbecker69@gmx.de>
Tue, 28 Jan 2020 08:15:23 +0000 (09:15 +0100)
committerChristoph M. Becker <cmbecker69@gmx.de>
Tue, 28 Jan 2020 08:18:05 +0000 (09:18 +0100)
Since this pattern is understood by compilers, not a real issue, but
certainly cleaner this way.

ext/mysqlnd/mysqlnd_portability.h

index 873f49b0cd19657b70f6d3a56f1545b55ac6a232..20649061933b6c35e7318f20aae1f2a78c463316 100644 (file)
@@ -15,7 +15,7 @@ This file is public domain and comes with NO WARRANTY of any kind */
 
 
 /* Comes from global.h as OFFSET, renamed to STRUCT_OFFSET */
-#define STRUCT_OFFSET(t, f)   ((size_t)(char *)&((t *)0)->f)
+#define STRUCT_OFFSET(t, f)   XtOffsetOf(t, f)
 
 #ifndef __attribute
 #if !defined(__GNUC__)