• E
    build: make VIR_FREE do some type checking · 90d761ee
    Eric Blake 提交于
    We can exploit the fact that gcc warns about int-to-pointer conversion
    in ternary cond?(void*):(int) in order to prevent future mistakes of
    calling VIR_FREE on a scalar lvalue.  For example, between commits
    158ba873 and 802e2df9, we would have had this warning:
    
    cc1: warnings being treated as errors
    remote.c: In function 'remoteDispatchListNetworks':
    remote.c:3684:70: error: pointer/integer type mismatch in conditional expression
    
    There are still a number of places that malloc into a const char*;
    while it would probably be worth scrubbing them to use char*
    instead, that is a separate patch, so we have to cast away const
    in VIR_FREE for now.
    
    * src/util/memory.h (VIR_FREE): Make gcc warn about integers.
    Iteratively developed from a patch by Christophe Fergeau.
    90d761ee
memory.h 7.8 KB