[tarantool-patches] Re: [PATCH v9] sql: add index_def to struct Index

  • From: Vladislav Shpilevoy <v.shpilevoy@xxxxxxxxxxxxx>
  • To: tarantool-patches@xxxxxxxxxxxxx, "n.pettik" <korablev@xxxxxxxxxxxxx>
  • Date: Wed, 4 Jul 2018 03:08:31 +0300


+             uint32_t iid, const char *name, uint32_t name_len, bool is_unique,
+             struct ExprList *expr_list, u8 idx_type)
+{
+       struct space_def *space_def = table->def;
+       size_t sql_size = 0;
+       struct index_opts opts;
+       index_opts_create(&opts);
+       index->def = NULL;
+       opts.is_unique = is_unique;
+       int rc = -1;

You don’t use this variable and in the end just reassign it:

This variable is reassigned on success only. On any error we
go to cleanup or tnt_error and rc remains -1.


+       if (index->def == NULL)
+               goto tnt_error;
+       rc = 0;
+cleanup:
+       if (key_def != NULL)
+               key_def_delete(key_def);
+       return rc;


Other related posts: