Removing (HANDLE)NULL casts (2)

Francois Gouget fgouget at
Sat Jan 4 21:28:34 CST 2003

On Thu, 28 Nov 2002, Francois Gouget wrote:

> Now that we compile Wine in STRICT mode we no longer need casts like
> (HRGN)NULL or (HWND)0 (not that we ever really needed the latter).

A few handle types escaped the script the first time around. So here is
an updated version that will catch them. The updated version will also
catch casts of NULL to LP{C,W,wC}STR and LPVOID.
Actually this looks like it could be a job for winapi_check...

So Alexandre, just run the script when you feel like it. It should
result in a 700-800 line diff. Alternately, let me know if you prefer
that I send a patch.


 * misc files

   Remove (POINTER)NULL casts


#egrep "\(( *HANDLE|HWND|HFONT|HICON|H) *\) *(NULL|0)" `find . -name "*.c"` | more


for file in `find . -name "*.c"`
    if egrep -q "\( *($pointers) *\) *(NULL|0)" "$file" /dev/null
        echo "$file"
        perl -p -i.orig -e 's/\( *('$pointers') *\) *(NULL|0(?!\w))/NULL/g' "$file"

Francois Gouget         fgouget at
                            $live{free} || die "";

More information about the wine-patches mailing list