[Libreoffice] [PUSHED, partial] Remove NULL checks from delete

Caolán McNamara caolanm at redhat.com
Mon Nov 7 04:50:09 PST 2011


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.

C.



More information about the LibreOffice mailing list