Re: [spice-server 2/2] red-parse-qxl: Change int/1/0 to bool/true/false

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 31, 2017 at 05:57:58AM -0400, Frediano Ziglio wrote:
> > 
> > The red_get_* methods in red-parse-qxl.c return a boolean, even though
> > their return type is an int, and they return 1/0. This commit changes
> > this to the more explicit bool/true/false.
> 
> Usually I prefer functions that succeed and return true, not false.
> With the current state looks like the functions are more returning
> an error code where (as usual) 0 means success.

Hmm I agree it's a bit odd. However, they only ever return 0 or 1, so
felt better to make that explicit, especially with

buf = (uint8_t *)memslot_get_virt(slots, qxl->attr.style,
                                          style_nseg * sizeof(QXLFIXED), group_id, &error);
if (error) {
    return error;
}

I can try reversing the conditions everywhere to return true on success/false
on error, but I suspect I'll get it wrong :)

Christophe

Attachment: signature.asc
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]