[pgpool-hackers: 3848] Re: Use list_delete_cell instead in some places

Bo Peng pengbo at sraoss.co.jp
Tue Oct 13 14:26:23 JST 2020


Hi,

On Mon, 12 Oct 2020 01:55:27 +0000
"Hou, Zhijie" <houzj.fnst at cn.fujitsu.com> wrote:

> I found some code path use list_delete_ptr while the loop of foreach() is iterating.
> 
> List_delete_ptr seems search the list again to find the target cell and delete it.
> >	foreach(cell, list)
> >	{
> >		if (lfirst(cell) == datum)
> >			return list_delete_cell(list, cell);
> >	}
> 
> 
> If we already get the cell in foreach loop, 
> I think we can use list_delete_cell to avoid searching the list again.
> 
> Please see the attachment for the patch.

Thank you for your patch.

Yes. You are right.
This change is imported from PostgreSQL 13' source code.
I am going to commit your patch.

-- 
Bo Peng <pengbo at sraoss.co.jp>
SRA OSS, Inc. Japan


More information about the pgpool-hackers mailing list