From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Vladimir Davydov Subject: [PATCH 7/8] tuple: zap tuple_format_dup Date: Sun, 14 Oct 2018 21:16:51 +0300 Message-Id: <917bab267b2848c020cad5a558054f2f2983b4c6.1539539421.git.vdavydov.dev@gmail.com> In-Reply-To: References: In-Reply-To: References: To: kostja@tarantool.org Cc: tarantool-patches@freelists.org List-ID: This function was only used for creating a format for tuples with column mask in vinyl. Not needed anymore and can be removed. Anyway, it doesn't make much sense to duplciate a tuple format, because it can be referenced instead. Besides, once JSON indexes are introcued, duplicating a tuple format will be really painful. One more reason to drop it now. --- src/box/tuple_format.c | 22 ---------------------- src/box/tuple_format.h | 10 ---------- 2 files changed, 32 deletions(-) diff --git a/src/box/tuple_format.c b/src/box/tuple_format.c index 5f4899d9..c510ffd9 100644 --- a/src/box/tuple_format.c +++ b/src/box/tuple_format.c @@ -324,28 +324,6 @@ tuple_format1_can_store_format2_tuples(const struct tuple_format *format1, return true; } -struct tuple_format * -tuple_format_dup(struct tuple_format *src) -{ - uint32_t total = sizeof(struct tuple_format) + - src->field_count * sizeof(struct tuple_field); - struct tuple_format *format = (struct tuple_format *) malloc(total); - if (format == NULL) { - diag_set(OutOfMemory, total, "malloc", "tuple format"); - return NULL; - } - memcpy(format, src, total); - tuple_dictionary_ref(format->dict); - format->id = FORMAT_ID_NIL; - format->refs = 0; - if (tuple_format_register(format) != 0) { - tuple_format_destroy(format); - free(format); - return NULL; - } - return format; -} - /** @sa declaration for details. */ int tuple_init_field_map(const struct tuple_format *format, uint32_t *field_map, diff --git a/src/box/tuple_format.h b/src/box/tuple_format.h index 344aada7..cbd4e4b4 100644 --- a/src/box/tuple_format.h +++ b/src/box/tuple_format.h @@ -233,16 +233,6 @@ tuple_format1_can_store_format2_tuples(const struct tuple_format *format1, const struct tuple_format *format2); /** - * Register the duplicate of the specified format. - * @param src Original format. - * - * @retval not NULL Success. - * @retval NULL Memory or format register error. - */ -struct tuple_format * -tuple_format_dup(struct tuple_format *src); - -/** * Returns the total size of tuple metadata of this format. * See @link struct tuple @endlink for explanation of tuple layout. * -- 2.11.0