In manage(), we use calloc in order to initialise to all-zeros the newly
allocated Client structure object.
A preferable, safer and more portable way of achieving such initialisation
is to use the compiler's static initialisation.
Here is the change in manage():
- Client *c, *t = NULL;
+ static Client czeroinit;
+ Client *c, *t = NULL;
- if(!(c = calloc(1, sizeof(Client))))
- die("fatal: could not calloc() %u bytes\n", sizeof(Client));
+ if(!(c = malloc(sizeof *c)))
+ die("fatal: out of memory\n");
+ *c = czeroinit;
-- Cheers, FilippoReceived on Sat Sep 06 2008 - 21:05:51 UTC
This archive was generated by hypermail 2.2.0 : Sat Sep 06 2008 - 21:12:03 UTC