rmtree cleanup

Started by Andrew Dunstanalmost 22 years ago3 messagespatches
Jump to latest
#1Andrew Dunstan
andrew@dunslane.net

The attached patch cleans up src/port/dirmod.c::rmtree() a bit. It moves
the filename finding portion into its own function, and in that function
only scans the directory once instead of twice.

cheers

andrew

Attachments:

rmtree.patchtext/x-patch; name=rmtree.patchDownload+82-45
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Andrew Dunstan (#1)
Re: rmtree cleanup

Andrew Dunstan <andrew@dunslane.net> writes:

The attached patch cleans up src/port/dirmod.c::rmtree() a bit. It moves
the filename finding portion into its own function, and in that function
only scans the directory once instead of twice.

Applied, along with some further hacking to reduce the #ifdef clutter
by providing palloc substitute routines. I checked it still works on
Unix, would you check I didn't break the Windows cases?

regards, tom lane

#3Andrew Dunstan
andrew@dunslane.net
In reply to: Tom Lane (#2)
Re: rmtree cleanup

Tom Lane wrote:

Andrew Dunstan <andrew@dunslane.net> writes:

The attached patch cleans up src/port/dirmod.c::rmtree() a bit. It moves
the filename finding portion into its own function, and in that function
only scans the directory once instead of twice.

Applied, along with some further hacking to reduce the #ifdef clutter
by providing palloc substitute routines.

Nice. It's actually readable now :-)

I checked it still works on
Unix, would you check I didn't break the Windows cases?

Yes, it works. Thanks.

andrew