<div dir="ltr">Hello. I'd like to ask about 'one kind of corrections".<div><br><div class="gmail_quote"><div dir="ltr">пт, 13 апр. 2018 г. в 12:50, n.pettik <<a href="mailto:korablev@tarantool.org" target="_blank">korablev@tarantool.org</a>>:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello. I still notice several codestyle violations.<br>
This patch can’t be pushed until all of them are fixed.<br>
Please, consider them.<br>
<br>
> On 12 Apr 2018, at 09:06, Hollow111 <<a href="mailto:hollow653@gmail.com" target="_blank">hollow653@gmail.com</a>> wrote:<br>
> <br>
> Hello. Here's the diff for the changes:<br>
> <br>
> diff --git a/src/box/sql/build.c b/src/box/sql/build.c<br>
> index 92f3cb6..0287183 100644<br>
> --- a/src/box/sql/build.c<br>
> +++ b/src/box/sql/build.c<br>
> @@ -2129,18 +2129,32 @@ sqliteViewResetAll(sqlite3 * db)<br>
>   * Remove entries from the _sql_stat1 and _sql_stat4<br>
>   * system spaces after a DROP INDEX or DROP TABLE command.<br>
>   *<br>
> - * @param pParse Parsing context.<br>
> - * @param zType Type of entry to be deleted:<br>
> - *           'idx' or 'tbl' string literal.<br>
> - * @param zName Name of index or table.<br>
> + * @param parse      The parsing context.<br>
> + * @param table_name The table to be dropped or<br>
> + *                   the table that contains index to be dropped.<br>
> + * @param idx_name   Index to be dropped.<br>
>   */<br>
>  static void<br>
> -sql_clear_stat_spaces(Parse * pParse, const char *zType, const char *zName)<br>
> +sql_clear_stat_spaces(Parse *parse, const char *table_name,<br>
> +                             const char *idx_name)<br>
<br>
Arguments which you carry to the next line, should start right below previous:<br>
<br>
void f(x int, ….<br>
          y char, ….<br>
          z double …);<br></blockquote><div><br></div><div>I couldnt find this in <span style="color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><span> </span>"C style guide" (<a href="https://tarantool.io/en/doc/2.0/dev_guide/c_style_guide.html">https://tarantool.io/en/doc/2.0/dev_guide/c_style_guide.html</a>)</span>

</div><div>Moreover according to this guide:</div><div>"Outside of comments, documentation and except in Kconfig, spaces are never used for indentation...".</div><div>Which means we're supposed to violate this rule</div><div>in case first argument is positioned not on the same range </div><div>from left corner of screen as any amount of 8-character tabs. </div><div>Maybe I'm wrong at smth but I'd like to have an explanation.</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
>  {<br>
> -     sqlite3NestedParse(pParse, "DELETE FROM \"_sql_stat1\" WHERE \"%s\"=%Q",<br>
> -                        zType, zName);<br>
> -     sqlite3NestedParse(pParse, "DELETE FROM \"_sql_stat4\" WHERE \"%s\"=%Q",<br>
> -                        zType, zName);<br>
> +     if (idx_name != NULL) {<br>
> +     sqlite3NestedParse(parse,<br>
<br>
Wrong indentation.<br>
<br>
> +                                     "DELETE FROM \"_sql_stat1\" WHERE (\"idx\"=%Q AND "<br>
> +                                     "\"tbl\"=%Q)",<br>
> +                                     idx_name, table_name);<br>
> +             sqlite3NestedParse(parse,<br>
> +                                     "DELETE FROM \"_sql_stat4\" WHERE (\"idx\"=%Q AND “<br>
<br>
Arguments which you carry to the next line, should start right below previous.<br>
<br>
> +                                     "\"tbl\"=%Q)",<br>
> +                                     idx_name, table_name);<br>
> +     } else {<br>
> +             sqlite3NestedParse(parse,<br>
> +                                     "DELETE FROM \"_sql_stat1\" WHERE \"tbl\"=%Q”,<br>
<br>
Arguments which you carry to the next line, should start right below previous.<br>
<br>
> +                                     table_name);<br>
> +             sqlite3NestedParse(parse,<br>
> +                    "DELETE FROM \"_sql_stat4\" WHERE \"tbl\"=%Q",<br>
> +                                     table_name);<br>
> +                                     }<br>
<br>
Wrong indentation.<br>
<br>
>  }<br>
>  <br>
>  /**<br>
> @@ -2325,7 +2339,7 @@ sql_drop_table(struct Parse *parse_context, struct SrcList *table_name_list,<br>
>        *    tuple with corresponding space_id from _space.<br>
>        */<br>
>  <br>
> -     sql_clear_stat_spaces(parse_context, "tbl", space_name);<br>
> +     sql_clear_stat_spaces(parse_context, space_name, NULL);<br>
>       struct Table *tab = sqlite3HashFind(&db->pSchema->tblHash, space_name);<br>
>       sqlite3FkDropTable(parse_context, table_name_list, tab);<br>
>       sql_code_drop_table(parse_context, space, is_view);<br>
> @@ -3328,7 +3342,7 @@ sql_drop_index(struct Parse *parse_context, struct SrcList *index_name_list,<br>
>        * But firstly, delete statistics since schema<br>
>        * changes after DDL.<br>
>        */<br>
> -     sql_clear_stat_spaces(parse_context, "idx", index->def->name);<br>
> +     sql_clear_stat_spaces(parse_context, table_name, index->def->name);<br>
>       int record_reg = ++parse_context->nMem;<br>
>       int space_id_reg = ++parse_context->nMem;<br>
>       sqlite3VdbeAddOp2(v, OP_Integer, space_id, space_id_reg);<br>
<br>
</blockquote></div></div></div>