diff options
author | Davi Arnaut <Davi.Arnaut@Sun.COM> | 2010-07-15 16:29:25 -0300 |
---|---|---|
committer | Davi Arnaut <Davi.Arnaut@Sun.COM> | 2010-07-15 16:29:25 -0300 |
commit | 4bb985ffd75bd0d293fcc3b68a3d9aee49418591 (patch) | |
tree | 10211c6d80f3dac03a8e313eb431312915e720b2 /sql/rpl_handler.cc | |
parent | 055f7fa159af3f106c62315fc6d39f26ab45c1ca (diff) | |
download | mariadb-git-4bb985ffd75bd0d293fcc3b68a3d9aee49418591.tar.gz |
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.
Diffstat (limited to 'sql/rpl_handler.cc')
-rw-r--r-- | sql/rpl_handler.cc | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/sql/rpl_handler.cc b/sql/rpl_handler.cc index 5d2a3f61b1e..5f16544d855 100644 --- a/sql/rpl_handler.cc +++ b/sql/rpl_handler.cc @@ -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()) + 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 - || !(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_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; |