"Ian Pilcher" <[EMAIL PROTECTED]> wrote:

> +
> +/*
> + * The Win32 doc says that RegCloseKey and HeapFree can fail, but it's hard to
> + * imagine why either of them would.  And what is the calling function supposed
> + * to do about it anyway?
> + */
> +
> +#define REGCLOSEKEY(X) \
> +{ \
> +    DWORD ret; \
> + \
> +    ret = RegCloseKey (X); \
> +    if (ret != ERROR_SUCCESS) \
> + WARN ("RegCloseKey returned %li\n", ret); \
> +}
> +
> +#define HEAPFREE(X,Y,Z) \
> +{ \
> +    if (HeapFree ((X), (Y), (Z)) == 0) \
> + WARN ("HeapFree failed with code %li\n", GetLastError ()); \
> +}

Certainly RegCloseKey and HeapFree can fail if someone will feed garbage to them,
but if you really know that parameters you pass are valid, there is no reason to
check the returned values. Please use simple RegCloseKey and HeapFree instead of
monster macros.




Reply via email to