[tarantool-patches] Re: [PATCH 4/4] sql: move SQL statistics to server

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Mon May 14 15:54:09 MSK 2018


Hello. Thanks for fixes!

On 14/05/2018 14:52, n.pettik wrote:
> 

>> I wish it was my task, huge malloc formatting is very interesting.
> 
> I wish I could understand whether this is sarcasm or not...

Not sarcasm.

> 
>>> diff --git a/src/box/sql/analyze.c b/src/box/sql/analyze.c
>>> index 57cac437c..4f21cd25f 100644
>>> --- a/src/box/sql/analyze.c
>>> +++ b/src/box/sql/analyze.c
>>> +decode_stat_string(const char *stat_string, int stat_size, tRowcnt *stat_exact,
>>> +		   LogEst *stat_log) {
>>> +	char *z = (char *) stat_string;
>>
>> 4. Why do you need this cast?
> 
> Since implicit cast discards const modifier and leads to compilation error.

No, I checked that. The code below is compiled ok. So you can remove the cast and
z variable.

diff --git a/src/box/sql/analyze.c b/src/box/sql/analyze.c
index 4f21cd25f..061fcc7ab 100644
--- a/src/box/sql/analyze.c
+++ b/src/box/sql/analyze.c
@@ -1230,7 +1230,7 @@ struct analysis_index_info {
  static void
  decode_stat_string(const char *stat_string, int stat_size, tRowcnt *stat_exact,
                    LogEst *stat_log) {
-       char *z = (char *) stat_string;
+       const char *z = stat_string;
         if (z == NULL)
                 z = "";
         for (int i = 0; *z && i < stat_size; i++) {





More information about the Tarantool-patches mailing list