[hackers] [dwm] using malloc() instead of calloc() and sticking to static initializer and struct assignment, not using *c = (Client){}; right now to avoid some ugly gcc warning, possibly a gcc bug since we are using -std=c99 || Anselm R Garbe

From: <hg_AT_suckless.org>
Date: Mon, 8 Sep 2008 21:24:10 +0000 (UTC)

changeset: 1358:e4bcaca8e6ef
tag: tip
user: Anselm R Garbe <garbeam_AT_gmail.com>
date: Mon Sep 08 22:24:05 2008 +0100
files: dwm.c
description:
using malloc() instead of calloc() and sticking to static initializer and struct assignment, not using *c = (Client){}; right now to avoid some ugly gcc warning, possibly a gcc bug since we are using -std=c99

diff -r 33591b7c6bf7 -r e4bcaca8e6ef dwm.c
--- a/dwm.c Sun Sep 07 09:53:59 2008 +0100
+++ b/dwm.c Mon Sep 08 22:24:05 2008 +0100
@@ -846,12 +846,14 @@
 
 void
 manage(Window w, XWindowAttributes *wa) {
+ static Client cz;
         Client *c, *t = NULL;
         Window trans = None;
         XWindowChanges wc;
 
- if(!(c = calloc(1, sizeof(Client))))
- die("fatal: could not calloc() %u bytes\n", sizeof(Client));
+ if(!(c = malloc(sizeof(Client))))
+ die("fatal: could not malloc() %u bytes\n", sizeof(Client));
+ *c = cz;
         c->win = w;
 
         /* geometry */
Received on Mon Sep 08 2008 - 21:24:10 UTC

This archive was generated by hypermail 2.2.0 : Mon Sep 08 2008 - 21:36:04 UTC