← Back to team overview

maria-developers team mailing list archive

Re: 25fe7dbad5d: Reduce usage of strlen()

 

Hi!

On Wed, Mar 31, 2021 at 5:18 PM Sergei Golubchik <serg@xxxxxxxxxxx> wrote:
>
> Hi, Michael!
>
> On Mar 31, Michael Widenius wrote:
> > commit 25fe7dbad5d
> > Author: Michael Widenius <michael.widenius@xxxxxxxxx>
> > Date:   Wed Aug 12 20:29:55 2020 +0300
> >
> >    Reduce usage of strlen()
>
> I'll only mention actual mistakes, no style comments or suggestions or
> question, just want to get it over with.
>
> > diff --git a/sql/item.h b/sql/item.h
> > index 9a6d0b4abfe..d6ff10bf3ba 100644
> > --- a/sql/item.h
> > +++ b/sql/item.h
> > @@ -1093,7 +1093,7 @@ class Item :public Value_source,
> >    void share_name_with(const Item *item)
> >    {
> >      name= item->name;
> > -    copy_flags(item, item_base_t::IS_AUTOGENERATED_NAME);
> > +    copy_flags(item, item_base_t::IS_EXPLICIT_NAME);
>
> belongs to a previous commit

Sorry about that, must have happened when I did a fixup trying to keep
things clean.
How can I move most easily to the right commit.
Do a rebase and do "edit" for the previous commit, do the change by
hand and continue the rebase?
Will try that.

> > diff --git a/sql/item_windowfunc.cc b/sql/item_windowfunc.cc
> > index 262481d019b..a9e008b0b92 100644
> > --- a/sql/item_windowfunc.cc
> > +++ b/sql/item_windowfunc.cc
> > @@ -99,13 +99,15 @@ Item_window_func::fix_fields(THD *thd, Item **ref)
> >
> >    if (window_spec->window_frame && is_frame_prohibited())
> >    {
> > -    my_error(ER_NOT_ALLOWED_WINDOW_FRAME, MYF(0), window_func()->func_name());
> > +    my_error(ER_NOT_ALLOWED_WINDOW_FRAME, MYF(0),
> > +             window_func()->func_name());
>
> This should be func_name().str, otherwise it'll crash or
> print garbage on Windows. Same below, in a couple of places.

Nope, this works thanks to this:

  inline const char *func_name() const
  { return (char*) func_name_cstring().str; }

So func_name() can be used (instead of the old variable func_name)
when one wants to have the a char* pointer.
This was convenient to have for future merges and make the changes in
the commit easier to read.

Regards,
Monty


References