CodingStyle: Update example to use our coding practice.
authorAndreas Schneider <asn@samba.org>
Tue, 20 Jan 2015 11:07:38 +0000 (12:07 +0100)
committerVolker Lendecke <vl@samba.org>
Tue, 20 Jan 2015 17:51:55 +0000 (18:51 +0100)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue Jan 20 18:51:55 CET 2015 on sn-devel-104

README.Coding

index f19399e7f24adf8c819f160e701fa0aa35c2dc4e..52dca49bede76e0e884d77a32c0055e47170f68c 100644 (file)
@@ -280,8 +280,8 @@ Good Examples:
                int ret = 0;
 
                if (y < 10) {
-                       z = malloc(sizeof(int)*y);
-                       if (!z) {
+                       z = malloc(sizeof(int) * y);
+                       if (z == NULL) {
                                ret = 1;
                                goto done;
                        }
@@ -290,7 +290,7 @@ Good Examples:
                print("Allocated %d elements.\n", y);
 
         done:
-               if (z) {
+               if (z != NULL) {
                        free(z);
                }
 
@@ -352,7 +352,7 @@ debugger.
 Good example:
 
        x = malloc(sizeof(short)*10);
-       if (!x) {
+       if (x == NULL) {
                fprintf(stderr, "Unable to alloc memory!\n");
        }