New EnumPrinterDataEx

Dmitry Timoshkov dmitry at sloboda.ru
Mon Feb 12 19:34:40 CST 2001


"Ian Pilcher" <pilcher at concentric.net> 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.






More information about the wine-devel mailing list