Hi, Nikita,

On Dec 06, Nikita Malyavin wrote:
> > >    template <typename T=char>
> > > -  inline T* alloc(size_t size) const
> > > -  {
> > > -    return (T*)alloc_root(mem_root, sizeof(T)*size);
> > > -  }
> > > -
> > > -  template <typename T=char>
> > >    inline T* calloc(size_t size) const
> >
> > Hmm, you didn't remove thd->calloc<>()
> 
> Well, I could do that, the calloc analogue looks like
> 
> new (thd) char[size] ();
> 
> Note the brackets before the semicolon -- they force zero
> initialization for scalar types, as well as for POD types:

did you test that it works?

it does require getting used to, but still I'd prefer a consistent API.
Either we have both alloc and calloc or neither.

> > > +void operator delete[](void *ptr, const Query_arena *thd) noexcept
> > > +{}
> > > +
> > > +void operator delete(void *ptr, const Query_arena *thd) noexcept
> > > +{}
> >
> > if you put them into sql_class.h - will they be inlined?
> 
> Apparently, one can't put a global operator new/delete definition into
> a header: then a linker finds duplicates:(

even if you declare them static inline?

Regards,
Sergei
Chief Architect, MariaDB Server
and secur...@mariadb.org
_______________________________________________
developers mailing list -- developers@lists.mariadb.org
To unsubscribe send an email to developers-le...@lists.mariadb.org

Reply via email to