Skip to content

Commit 412b476

Browse files
committed
Fix #79172: STRUCT_OFFSET() relies on undefined behavior
Since this pattern is understood by compilers, not a real issue, but certainly cleaner this way.
1 parent 5215f07 commit 412b476

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ext/mysqlnd/mysqlnd_portability.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ This file is public domain and comes with NO WARRANTY of any kind */
1515

1616

1717
/* Comes from global.h as OFFSET, renamed to STRUCT_OFFSET */
18-
#define STRUCT_OFFSET(t, f) ((size_t)(char *)&((t *)0)->f)
18+
#define STRUCT_OFFSET(t, f) XtOffsetOf(t, f)
1919

2020
#ifndef __attribute
2121
#if !defined(__GNUC__)

0 commit comments

Comments
 (0)