Commit b5098f3d authored by Alexander Barkov's avatar Alexander Barkov

MDEV-13533 Remove the THD parameter from sp_head::init_sp_name()

parent 3f7f0c6a
...@@ -610,7 +610,7 @@ sp_head::init(LEX *lex) ...@@ -610,7 +610,7 @@ sp_head::init(LEX *lex)
void void
sp_head::init_sp_name(THD *thd, const sp_name *spname) sp_head::init_sp_name(const sp_name *spname)
{ {
DBUG_ENTER("sp_head::init_sp_name"); DBUG_ENTER("sp_head::init_sp_name");
...@@ -619,10 +619,10 @@ sp_head::init_sp_name(THD *thd, const sp_name *spname) ...@@ -619,10 +619,10 @@ sp_head::init_sp_name(THD *thd, const sp_name *spname)
DBUG_ASSERT(spname && spname->m_db.str && spname->m_db.length); DBUG_ASSERT(spname && spname->m_db.str && spname->m_db.length);
/* We have to copy strings to get them into the right memroot. */ /* We have to copy strings to get them into the right memroot. */
Database_qualified_name::copy(mem_root, spname->m_db, spname->m_name); Database_qualified_name::copy(&main_mem_root, spname->m_db, spname->m_name);
m_explicit_name= spname->m_explicit_name; m_explicit_name= spname->m_explicit_name;
spname->make_qname(thd, &m_qname); spname->make_qname(&main_mem_root, &m_qname);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
......
...@@ -320,7 +320,7 @@ class sp_head :private Query_arena, ...@@ -320,7 +320,7 @@ class sp_head :private Query_arena,
/** Copy sp name from parser. */ /** Copy sp name from parser. */
void void
init_sp_name(THD *thd, const sp_name *spname); init_sp_name(const sp_name *spname);
/** Set the body-definition start position. */ /** Set the body-definition start position. */
void void
......
...@@ -5984,13 +5984,13 @@ class Database_qualified_name ...@@ -5984,13 +5984,13 @@ class Database_qualified_name
(int) m_name.length, m_name.str); (int) m_name.length, m_name.str);
} }
// Export db and name as a qualified name string, allocate on mem_root. // Export db and name as a qualified name string, allocate on mem_root.
bool make_qname(THD *thd, LEX_CSTRING *dst) const bool make_qname(MEM_ROOT *mem_root, LEX_CSTRING *dst) const
{ {
const uint dot= !!m_db.length; const uint dot= !!m_db.length;
char *tmp; char *tmp;
/* format: [database + dot] + name + '\0' */ /* format: [database + dot] + name + '\0' */
dst->length= m_db.length + dot + m_name.length; dst->length= m_db.length + dot + m_name.length;
if (!(dst->str= tmp= (char*) thd->alloc(dst->length + 1))) if (!(dst->str= tmp= (char*) alloc_root(mem_root, dst->length + 1)))
return true; return true;
sprintf(tmp, "%.*s%.*s%.*s", sprintf(tmp, "%.*s%.*s%.*s",
(int) m_db.length, (m_db.length ? m_db.str : ""), (int) m_db.length, (m_db.length ? m_db.str : ""),
......
...@@ -5845,7 +5845,7 @@ sp_head *LEX::make_sp_head(THD *thd, const sp_name *name, ...@@ -5845,7 +5845,7 @@ sp_head *LEX::make_sp_head(THD *thd, const sp_name *name,
sp->reset_thd_mem_root(thd); sp->reset_thd_mem_root(thd);
sp->init(this); sp->init(this);
if (name) if (name)
sp->init_sp_name(thd, name); sp->init_sp_name(name);
sphead= sp; sphead= sp;
} }
sp_chistics.init(); sp_chistics.init();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment