[hackers] [tabbed] Replace emallocz with ecalloc. || noname

From: <git_AT_suckless.org>
Date: Sun, 01 Jun 2014 16:14:14 +0200

commit 9d1d6d9409df1a7045806c1e802d89d08b0ae0a7
Author: noname <noname_AT_inventati.org>
Date: Sat May 24 23:09:56 2014 +0400

    Replace emallocz with ecalloc.
    
    Signed-off-by: Christoph Lohmann <20h_AT_r-36.net>

diff --git a/tabbed.c b/tabbed.c
index 2341998..ba22f9a 100644
--- a/tabbed.c
+++ b/tabbed.c
_AT_@ -97,7 +97,7 @@ static void destroynotify(const XEvent *e);
 static void die(const char *errstr, ...);
 static void drawbar(void);
 static void drawtext(const char *text, unsigned long col[ColLast]);
-static void *emallocz(size_t size);
+static void *ecalloc(size_t n, size_t size);
 static void *erealloc(void *o, size_t size);
 static void expose(const XEvent *e);
 static void focus(int c);
_AT_@ -399,11 +399,11 @@ drawtext(const char *text, unsigned long col[ColLast]) {
 }
 
 void *
-emallocz(size_t size) {
+ecalloc(size_t n, size_t size) {
         void *p;
 
- if(!(p = calloc(1, size)))
- die("tabbed: cannot malloc
");
+ if(!(p = calloc(n, size)))
+ die("tabbed: cannot calloc
");
         return p;
 }
 
_AT_@ -713,7 +713,7 @@ manage(Window w) {
                         }
                 }
 
- c = emallocz(sizeof(*c));
+ c = ecalloc(1, sizeof *c);
                 c->win = w;
 
                 nclients++;
_AT_@ -921,7 +921,7 @@ void
 setcmd(int argc, char *argv[], int replace) {
         int i;
 
- cmd = emallocz((argc+3) * sizeof(*cmd));
+ cmd = ecalloc(argc + 3, sizeof *cmd);
         if (argc == 0)
                 return;
         for(i = 0; i < argc; i++)
Received on Sun Jun 01 2014 - 16:14:14 CEST

This archive was generated by hypermail 2.3.0 : Sun Jun 01 2014 - 16:24:13 CEST