On 11/07/2011 07:50 AM, Caolán McNamara wrote:
On Mon, 2011-09-19 at 20:58 +0200, Thomas Arnhold wrote:
Hi,
I've recently seen some changes, which removed unnecessary NULL checks
for delete commands with the form:
- if (pTextPContext)
- delete pTextPContext;
+ delete pTextPContext;
Codebase is full with these. I've attached a little perl script which
should solve this conversion. I've attached a sample for the vcl dir.
Any objections?
Those extraneous if's annoy me alright, but a mass conversion would need
more cunning, e.g. extra stuff done inside the if, and else branches,
e.g. the sample patch has this catch...
- if ( mpDisplayDev )
- delete mpDisplayDev;
+ delete mpDisplayDev;
else
{
so end up with a bare else. I pushed the working bits in the mean time.
I assume that this would check for an array as well.
I would feel safer if pointers were set to NULL (or nullptr if we
support C++11) since it is not safe to delete a pointer twice.
--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
Info: http://www.pitonyak.org/oo.php
_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice