[Libreoffice] LibreOffice Code Cleanup Patch

Alexander Bergmann myaddons at gmx.de
Fri Jan 27 01:55:50 PST 2012


Hi Muthu,

> Its nice to see those patches. But, it will be nice to see/use the
> tools/scripts directly? Especially if they can be hooked to git (like
> the current white space/tabs removal ones)?

First I noticed, that ( () ) did only appear in two cases: SAL_THROW( () 
) and THROWS( () )

As I wanted to be sure of that, I used the following command to filter 
lines, which contain SAL_THROW or THROWS:
$ git grep -I "( () )" | grep -v "SAL_THROW" | grep -v "THROWS"

The command didn't find anything else, so I assumed it is safe to 
replace ( () ) by (()) in all these cases. (I guess creating two patches 
- one for SAL_THROW and one for THROWS - would have been safer.)

To replace ( () ) by (()) I used the following command:
$ git grep -I -l "( () )" | while read line ; do sed -i -e "s/( () 
)/(())/g" "$line" ; done

> @Alex: Forgot to mention one more thing: We follow (normally) space
> after '(' and before ')' if there are parameters. Sometimes, we would be
> tempted to remove the space in cases like foo( param1, param2 ); as well
> ;) ( I am always tempted in such cases :P )

Actually both variants SAL_THROW(()) & SAL_THROW( () ) and accordingly 
THROWS( () ) & THROWS(()) were found in the code base before the code 
cleanup. I have chosen the first one, because I discovered the use of 
ANSI, which was always written as ANSI(()) and never as ANSI( () ).

I personally prefer - in this case - the first one, but if you wish to 
use the second one, this is also no problem at all... (But I don't think 
using both variants - one over here and one over there - is a good idea.)

Best regards,
Alexander

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20120127/978f69c3/attachment.htm>


More information about the LibreOffice mailing list