mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Bug#42733: Type-punning warnings when compiling MySQL -- strict aliasing violations.
Silence bogus aliasing warning through a pointer indirection. Also, no need to check the return of a placement new.
This commit is contained in:
@ -99,22 +99,34 @@ int delegates_init()
|
||||
MY_ALIGNOF(long)> relay_io_mem;
|
||||
#endif
|
||||
|
||||
if (!(transaction_delegate= new (trans_mem.data) Trans_delegate)
|
||||
|| (!transaction_delegate->is_inited())
|
||||
|| !(binlog_storage_delegate=
|
||||
new (storage_mem.data) Binlog_storage_delegate)
|
||||
|| (!binlog_storage_delegate->is_inited())
|
||||
#ifdef HAVE_REPLICATION
|
||||
|| !(binlog_transmit_delegate=
|
||||
new (transmit_mem.data) Binlog_transmit_delegate)
|
||||
|| (!binlog_transmit_delegate->is_inited())
|
||||
|| !(binlog_relay_io_delegate=
|
||||
new (relay_io_mem.data) Binlog_relay_IO_delegate)
|
||||
|| (!binlog_relay_io_delegate->is_inited())
|
||||
#endif /* HAVE_REPLICATION */
|
||||
)
|
||||
void *place_trans_mem= trans_mem.data;
|
||||
void *place_storage_mem= storage_mem.data;
|
||||
|
||||
transaction_delegate= new (place_trans_mem) Trans_delegate;
|
||||
|
||||
if (!transaction_delegate->is_inited())
|
||||
return 1;
|
||||
|
||||
binlog_storage_delegate= new (place_storage_mem) Binlog_storage_delegate;
|
||||
|
||||
if (!binlog_storage_delegate->is_inited())
|
||||
return 1;
|
||||
|
||||
#ifdef HAVE_REPLICATION
|
||||
void *place_transmit_mem= transmit_mem.data;
|
||||
void *place_relay_io_mem= relay_io_mem.data;
|
||||
|
||||
binlog_transmit_delegate= new (place_transmit_mem) Binlog_transmit_delegate;
|
||||
|
||||
if (!binlog_transmit_delegate->is_inited())
|
||||
return 1;
|
||||
|
||||
binlog_relay_io_delegate= new (place_relay_io_mem) Binlog_relay_IO_delegate;
|
||||
|
||||
if (!binlog_relay_io_delegate->is_inited())
|
||||
return 1;
|
||||
#endif
|
||||
|
||||
if (pthread_key_create(&RPL_TRANS_BINLOG_INFO, NULL))
|
||||
return 1;
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user