MDEV-26376 pars_info_bind_id() unnecessarily copies strings

pars_info_bind_id(): Remove the parameter copy_name. It was always
being passed as constant TRUE or true. It turns out that copying
the string is completely unnecessary. In all calls except the one
in fts_get_select_columns_str() and fts_doc_fetch_by_doc_id(),
the parameter is being passed as a compile-time constant, and therefore
the pointer cannot become stale. In that special call, the string
that is being passed is allocated from the same memory heap that
pars_info_bind_id() would have been using.

pars_info_add_id(): Remove (unused declaration).
This commit is contained in:
Marko Mäkelä 2021-08-16 12:10:20 +03:00
commit 4cd063b9e4
8 changed files with 37 additions and 51 deletions

View file

@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2019, MariaDB Corporation.
Copyright (c) 2017, 2021, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@ -491,7 +491,6 @@ void
pars_info_bind_id(
/*=============*/
pars_info_t* info, /*!< in: info struct */
ibool copy_name,/* in: make a copy of name if TRUE */
const char* name, /*!< in: name */
const char* id); /*!< in: id */
/****************************************************************//**
@ -537,15 +536,6 @@ pars_info_bind_ull_literal(
const ib_uint64_t* val) /*!< in: value */
MY_ATTRIBUTE((nonnull));
/****************************************************************//**
Add bound id. */
void
pars_info_add_id(
/*=============*/
pars_info_t* info, /*!< in: info struct */
const char* name, /*!< in: name */
const char* id); /*!< in: id */
/****************************************************************//**
Get bound literal with the given name.
@return bound literal, or NULL if not found */