From: Sergey Vojtovich Date: June 3 2011 7:13am Subject: Re: bzr commit into mysql-5.5 branch (sergey.vojtovich:3416) Bug#12611785 List-Archive: http://lists.mysql.com/commits/138618 Message-Id: <20110603071331.GA23490@june> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Hi Davi, thanks for the review. I'll fix the patch according to your suggestion. Regards, Sergey On Thu, Jun 02, 2011 at 06:45:19PM -0300, Davi Arnaut wrote: > Hi Sergey, > > On 6/2/11 5:34 AM, Sergey Vojtovich wrote: > > #At file:///home/svoj/mysql/server/mysql-5.5-audit/ based on revid:jimmy.yang@stripped > > > > 3416 Sergey Vojtovich 2011-06-02 > > BUG#12611785 - AUDIT INTERFACE STRICT-ALIASING WARNINGS > > > > The types mysql_event_general/mysql_event_connection are > > being cast to the incompatible type mysql_event. The way > > mysql_event and the other types are designed are prone to > > strict aliasing violations and can break things depending > > on how compilers optimizes this code. > > > > This patch fixes audit interface, so it confirms to strict- > > aliasing rules. It introduces incompatible changes to audit > > interface: > > - mysql_event type has been removed; > > - event_class has been removed from mysql_event_generic and > > mysql_event_connection types; > > - st_mysql_audit::event_notify() second argument is event_class; > > - st_mysql_audit::event_notify() third argument is event of type > > (const void *). > > > > OK to push. One minor comment below. > > > -static void event_class_dispatch(THD *thd, const struct mysql_event *event) > > +static void event_class_dispatch(THD *thd, unsigned int event_class, > > + const void *event) > > { > > + struct st_mysql_event_generic event_generic; > > + event_generic.event_class= event_class; > > + event_generic.event= event; > > /* > > Check if we are doing a slow global dispatch. This event occurs when > > thd == NULL as it is not associated with any particular thread. > > */ > > if (unlikely(!thd)) > > { > > - plugin_foreach(thd, plugins_dispatch, MYSQL_AUDIT_PLUGIN, (void*) event); > > + plugin_foreach(thd, plugins_dispatch, MYSQL_AUDIT_PLUGIN, > > + (void *) &event_generic); > > } > > else > > { > > @@ -476,7 +487,7 @@ static void event_class_dispatch(THD *th > > plugins_last= plugins + thd->audit_class_plugins.elements; > > > > for (; plugins < plugins_last; plugins++) > > - plugins_dispatch(thd, *plugins, (void*) event); > > + plugins_dispatch(thd, *plugins, (void *) &event_generic); > > Void cast not necessary, it's automatic. > > Thanks for working on this! > > Regards, > > davi -- Sergey Vojtovich MySQL AB, Software Engineer Izhevsk, Russia, www.mysql.com