Re: [Maria-developers] [Commits] Rev 2951: WL#12 - MariaDB User Feedback (a.k.a. Phone Home) plugin
![](https://secure.gravatar.com/avatar/3c2329333dd5898f2e72818af773243d.jpg?s=120&d=mm&r=g)
Hi, Michael! On Oct 27, Michael Widenius wrote:
"Sergei" == Sergei Golubchik
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
(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
(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
![](https://secure.gravatar.com/avatar/06b8a7f236cf59aa9a83cab1a0551ca8.jpg?s=120&d=mm&r=g)
Hi!
"Sergei" == Sergei Golubchik
writes:
Sergei> Hi, Michael! Sergei> On Oct 27, Michael Widenius wrote:
> "Sergei" == Sergei Golubchik
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
(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
(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
participants (2)
-
Michael Widenius
-
Sergei Golubchik