[Commits] Rev 2951: WL#12 - MariaDB User Feedback (a.k.a. Phone Home) plugin

Michael Widenius monty at askmonty.org
Mon Nov 1 01:21:25 EET 2010


Hi!

>>>>> "Sergei" == Sergei Golubchik <serg at askmonty.org> writes:

Sergei> Hi, Michael!
Sergei> On Oct 27, Michael Widenius wrote:
>> >>>>> "Sergei" == Sergei Golubchik <serg at askmonty.org> writes:
>> 
>> >> +++ b/plugin/feedback/sender_thread.cc	2010-09-30 14:24:31 +0000
>> > ...
>> >> +      if (thd) // for nicer SHOW PROCESSLIST
>> >> +        thd->set_query(const_cast<char*>(url->url()), url->url_length());
>> >> 
>> >> Wouldn't it be better if url->url() would return const char * ?
>> 
>> > It does return const char*, but thd->set_query() wants char* (for no
>> > good reason), so I need to cast const away.
>> 
>> Should we change set_query() to take const char * ?

Sergei> I can do that, yes, but this plugin will need a cast anyway to work with
Sergei> MySQL sources.
 
Please do the fix in in 5.2 at some point

>> >> +Url* http_create(const char *url, size_t url_length)
>> >> +{
>> >> +  const char *s;
>> >> +  LEX_STRING full_url= {const_cast<char*>(url), url_length};
>> >> +  LEX_STRING host, port, path;
>> >> 
>> >> Would it not be better to introduce LEX_CONS_STRING and use these to
>> >> avoid const away casts? 
>> 
>> > Perhaps, if I'd have more casts because of that. But just because of one
>> > or two - I'd rather keep the code uniform instead and use LEX_STRING
>> > everywhere.
>> 
>> I tink there is many cases in the code where we have to cast const
>> away just becasue we don't have LEX_CONST_STRING. Don't you think it's
>> time to introduce it ?

Sergei> Not in the plugin.
Sergei> Btw, MariaDB already has LEX_CUSTRING (const unsigned) variant.
 
We also need a LEX_CONST_STRING which is not unsigned (to allow it to
take const char* as parameters....)

Regards,
Monty


More information about the commits mailing list