On Mon, Jan 31, 2022 at 1:12 PM houzj.fnst@fujitsu.com
<houzj.fnst@fujitsu.com> wrote:
>
> > > + /*
> > > + * We need this map to avoid relying on ReorderBufferChangeType
> > enums
> > > + * having specific values.
> > > + */
> > > + static int map_changetype_pubaction[] = {
> > > + [REORDER_BUFFER_CHANGE_INSERT] = PUBACTION_INSERT,
> > > + [REORDER_BUFFER_CHANGE_UPDATE] = PUBACTION_UPDATE,
> > > + [REORDER_BUFFER_CHANGE_DELETE] = PUBACTION_DELETE
> > > + };
> >
> > Why is this "static"? Function-local statics only really make sense for variables
> > that are changed and should survive between calls to a function.
>
> Removed the "static" label.
>
This array was only ever meant to be read-only, and visible only to
that function.
IMO removing "static" makes things worse because now that array gets
initialized each call to the function, which is unnecessary.
I think it should just be: "static const int map_changetype_pubaction[] = ..."
Regards,
Greg Nancarrow
Fujitsu Australia