← Back to team overview

maria-developers team mailing list archive

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

 

Hi, Michael!

On Oct 27, Michael Widenius wrote:
> >>>>> "Sergei" == Sergei Golubchik <serg@xxxxxxxxxxxx> 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 * ?

I can do that, yes, but this plugin will need a cast anyway to work with
MySQL sources.
 
> >> +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 ?

Not in the plugin.
Btw, MariaDB already has LEX_CUSTRING (const unsigned) variant.
 
Regards,
Sergei



Follow ups

References