[PATCH 09/11] btrfs-progs: use calloc instead of malloc+memset for quick-test.c

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

 



This patch is generated from a coccinelle semantic patch:

	identifier t;
	expression e;
	statement s;
	@@
	-t = malloc(e);
	+t = calloc(1, e);
	(
	if (!t) s
	|
	if (t == NULL) s
	|
	)
	-memset(t, 0, e);

Signed-off-by: Silvio Fricke <silvio.fricke@xxxxxxxxx>
---
 quick-test.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/quick-test.c b/quick-test.c
index 5dfb2fe..ffde85d 100644
--- a/quick-test.c
+++ b/quick-test.c
@@ -46,8 +46,7 @@ int main(int ac, char **av) {
 	struct btrfs_root *root;
 	struct btrfs_trans_handle *trans;
 
-	buf = malloc(512);
-	memset(buf, 0, 512);
+	buf = calloc(1, 512);
 
 	radix_tree_init();
 
-- 
2.5.3

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux