From b2e5df5bf611afe0751cd2f6954bc384e706dfbe Mon Sep 17 00:00:00 2001 From: Georgy Moshkin <gmoshkin@picodata.io> Date: Thu, 24 Aug 2023 16:37:43 +0300 Subject: [PATCH] box: factor out new_tuple def construction A tiny preparatory commit for meta-temporary spaces NO_DOC=refactoring NO_TEST=refactoring NO_CHANGELOG=refactoring --- src/box/alter.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/box/alter.cc b/src/box/alter.cc index 89bd4d9083..c065a4a210 100644 --- a/src/box/alter.cc +++ b/src/box/alter.cc @@ -2189,10 +2189,13 @@ on_replace_dd_space(struct trigger * /* trigger */, void *event) BOX_SPACE_FIELD_ID, &old_id) != 0) return -1; struct space *old_space = space_by_id(old_id); + struct space_def *def = NULL; + if (new_tuple != NULL) { + uint32_t errcode = (old_tuple == NULL) ? + ER_CREATE_SPACE : ER_ALTER_SPACE; + def = space_def_new_from_tuple(new_tuple, errcode, region); + } if (new_tuple != NULL && old_space == NULL) { /* INSERT */ - struct space_def *def = - space_def_new_from_tuple(new_tuple, ER_CREATE_SPACE, - region); if (def == NULL) return -1; auto def_guard = @@ -2352,9 +2355,6 @@ on_replace_dd_space(struct trigger * /* trigger */, void *event) "view can not be altered"); return -1; } - struct space_def *def = - space_def_new_from_tuple(new_tuple, ER_ALTER_SPACE, - region); if (def == NULL) return -1; auto def_guard = -- GitLab