Re: xcalloc question

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Tue, 16 Oct 2001 18:09:26 +0200

Adrian Chadd wrote:

> Ok, so here's my question: in access_log.c, there's this bit of code:
>
> buf = xcalloc((strlen(header) * 3) + 1, 1);
>
> Now, it _looks_ like someone got the xcalloc arguments backwards,
> right? Can anyone see any reason why this code should be allocating
> RAM using the above arguments?

Does not really matter.

xcalloc((strlen(header) * 3) + 1, 1)

allocate an array of 1 byte items (char), (strlen(header) * 3) + 1 long

xcalloc(1, (strlen(header) * 3) + 1)

allocate one item, (strlen(header) * 3) + 1 long

--
Henrik
Received on Tue Oct 16 2001 - 10:08:29 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:14:32 MST