From 852fda9cb5c18a2454b80b16ab35aece58b53abb Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Tue, 20 Jan 2015 12:07:38 +0100 Subject: [PATCH] CodingStyle: Update example to use our coding practice. Signed-off-by: Andreas Schneider Reviewed-by: Volker Lendecke Autobuild-User(master): Volker Lendecke Autobuild-Date(master): Tue Jan 20 18:51:55 CET 2015 on sn-devel-104 --- README.Coding | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.Coding b/README.Coding index f19399e7f24..52dca49bede 100644 --- a/README.Coding +++ b/README.Coding @@ -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"); } -- 2.11.4.GIT