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

Ivan Timofeev timofeev.i.s at gmail.com
Thu Nov 17 11:02:24 PST 2011


I have played with manual solving of this problem today... :-) There are 
the more interesting examples:

- else if(pUserMarker)
+ else
{
     delete pUserMarker;
     pUserMarker = 0L;
}

and

- if( GetPageNum() > 0 && pCntntAnchor )
+ if( GetPageNum() > 0 )
{
     delete pCntntAnchor;


Actually, catching these with regexp-search is hard...

17.11.2011 14:16, Michael Meeks пишет:
> 	If we have a bug whereby something is deleted in-the code without being
> re-assigned, and where NULL is a valid value, then we could fix those
> with a DELETEZ construct, but - finding those places (that don't already
> have a subsequent assignment) is prolly more exciting :-) In theory some
> code analysis framework could help find those guys.

I am agree. I think, it is better to find the problematic places by 
searching in the syntax-tree rather than in the source files.

Cheers,
         Ivan


More information about the LibreOffice mailing list