[hackers] [ubase] Use calloc() instead of malloc() + memset() || sin

From: <git_AT_suckless.org>
Date: Mon, 10 Feb 2014 20:29:51 +0100

commit 9a4fba02519efc4382fd605ec144ace2fd461798
Author: sin <sin_AT_2f30.org>
Date: Mon Feb 10 19:28:39 2014 +0000

    Use calloc() instead of malloc() + memset()

diff --git a/insmod.c b/insmod.c
index 484c544..730b71a 100644
--- a/insmod.c
+++ b/insmod.c
_AT_@ -51,10 +51,9 @@ main(int argc, char *argv[])
                 plen += strlen(argv[i]);
         if (plen > 0) {
                 plen += argc;
- opts = malloc(plen);
+ opts = calloc(1, plen);
                 if (!opts)
                         eprintf("malloc:");
- memset(opts, 0, plen);
                 for (i = 0; i < argc; i++) {
                         strcat(opts, argv[i]);
                         if (i + 1 < argc)
Received on Mon Feb 10 2014 - 20:29:51 CET

This archive was generated by hypermail 2.3.0 : Mon Feb 10 2014 - 20:36:22 CET