[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[manual] Example update needed for printf(3)
From: |
iq-0 |
Subject: |
[manual] Example update needed for printf(3) |
Date: |
Fri, 23 Feb 2001 18:33:20 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux 2.2.16-22 i686; en-US; 0.8) Gecko/20010215 |
Hello,
There is a nice example at the bottom of the printf(3) manual page.
There are 2 things remarks I would like to make, one which should
probably be changed, the other pherhaps not (but I think so).
1) At the bottom, when a realloc fails, it doesn't free the original
pointer. In my personal copy of this function i also have a char *q,
which is used as a intermediate around the realloc for the case it fails:
if ((q = realloc (p, size)) == NULL)
{ /* If realloc fails p remains unchanged, according to doc,
let's check and free() */
if (p != NULL)
free (p);
return NULL;
} else
p = q;
2) In case of glibc version 2.0 resize statement, it would be nice if it
were something like += 100 instead of*=2 I think most people who really
would use it to concat a long string would not want that the double
amount of space would be used!!
I know this is just an example, but is fairly nice, and I think people
actually use it.
Regards,
justin....
- [manual] Example update needed for printf(3),
iq-0 <=