Coding style updates
Jelmer Vernooij
jelmer at samba.org
Sun Oct 21 13:28:23 GMT 2007
Am Sonntag, den 21.10.2007, 08:23 -0500 schrieb Gerald (Jerry) Carter:
> - - if ((x = malloc(sizeof(short)*10)) == NULL ) {
> + x = malloc(sizeof(short)*10);
> + if (!x) {
> fprintf(stderr, "Unable to alloc memory!\n");
> }
>
> or
>
> - - x = malloc(sizeof(short)*10);
> - - if (!x) {
> + if ((x = malloc(sizeof(short)*10)) == NULL) {
> fprintf(stderr, "Unable to alloc memory!\n");
> }
>
> - -1. We had this discussion before as well. Mainly I don't
> like the "this one *or* that one". Pick one. We previously
> decided on if ((x=malloc) == NULL) format.
This seems inconsistent. If you favor "if (ptr)" over "if (ptr !=
NULL)", it should also be "if (!(x=malloc(...)))".
Cheers,
Jelmer
--
Jelmer Vernooij <jelmer at samba.org> - http://samba.org/~jelmer/
Jabber: jelmer at jabber.fsfe.org
More information about the samba-technical
mailing list