[Spice-devel] [PATCH spice-server 2/3] test-gst: Remove options parsing leaks

Christophe Fergeau cfergeau at redhat.com
Tue Sep 12 11:22:05 UTC 2017


On Tue, Sep 12, 2017 at 07:19:32AM -0400, Frediano Ziglio wrote:
> About checking for pointer assuming you have to check for NULL
> would mean the NULL is not 0 which would mean that
> memset(structure_ptr, 0, sizeof(structure)) cannot set pointer
> to NULL which would mean that assuming pointer initialized from
> GObject NULL are not correct, I would personally vote again
> the if (pointer != NULL) style, if (pointer) is good as well.

I'm not saying it's more correct, I'm saying it can make the code easier
to read.

if (obscure_name) {} -> you know from reading the code it's a boolean
if (obscure_name != 0) {} -> ok, it's some int value
if (obscure_name == NULL) {} -> this time it's a pointer

Christophe


More information about the Spice-devel mailing list