mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 10:14:19 +01:00
Move function from header file to make it easier to debug
This commit is contained in:
parent
dac499ce7c
commit
7daf98db15
2 changed files with 17 additions and 14 deletions
16
sql/item.cc
16
sql/item.cc
|
@ -297,6 +297,22 @@ longlong Item::val_int_from_decimal()
|
|||
}
|
||||
|
||||
|
||||
void *Item::operator new(size_t size, Item *reuse, uint *rsize)
|
||||
{
|
||||
if (reuse && size <= reuse->rsize)
|
||||
{
|
||||
reuse->cleanup();
|
||||
TRASH((void *)reuse, size);
|
||||
if (rsize)
|
||||
(*rsize)= reuse->rsize;
|
||||
return (void *)reuse;
|
||||
}
|
||||
if (rsize)
|
||||
(*rsize)= size;
|
||||
return (void *)sql_alloc((uint)size);
|
||||
}
|
||||
|
||||
|
||||
Item::Item():
|
||||
rsize(0), name(0), orig_name(0), name_length(0), fixed(0),
|
||||
collation(&my_charset_bin, DERIVATION_COERCIBLE)
|
||||
|
|
15
sql/item.h
15
sql/item.h
|
@ -233,20 +233,7 @@ public:
|
|||
static void *operator new(size_t size, MEM_ROOT *mem_root)
|
||||
{ return (void*) alloc_root(mem_root, (uint) size); }
|
||||
/* Special for SP local variable assignment - reusing slots */
|
||||
static void *operator new(size_t size, Item *reuse, uint *rsize)
|
||||
{
|
||||
if (reuse && size <= reuse->rsize)
|
||||
{
|
||||
reuse->cleanup();
|
||||
TRASH((void *)reuse, size);
|
||||
if (rsize)
|
||||
(*rsize)= reuse->rsize;
|
||||
return (void *)reuse;
|
||||
}
|
||||
if (rsize)
|
||||
(*rsize)= size;
|
||||
return (void *)sql_alloc((uint)size);
|
||||
}
|
||||
static void *operator new(size_t size, Item *reuse, uint *rsize);
|
||||
static void operator delete(void *ptr,size_t size) { TRASH(ptr, size); }
|
||||
static void operator delete(void *ptr, MEM_ROOT *mem_root) {}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue