[JDEV] FIX in io.c
tcharron at nermail.ups.com
Tue Feb 23 13:13:57 CST 1999
I just stumbled accross a comment in io.c in the lib/common directory..
/* There has got to be a better way to do this! */
old = c->buff;
c->buff = malloc(strlen(c->buff) + strlen(buffer) + 1);
c->buff = '\0';
There is a better way.. ;-P
realloc(c->buff, strlen(c->buff) + strlen(buffer) + 1);
MUCH prettier, isn't it?? ;-P Under Unix do a man malloc, it explains
realloc fairly well.. realloc does exactly what you where doing, but in a
much less overhead way..
United Parcel Service
IE Software Developer
"Moving at the speed of a T3 Trunk Line!"
More information about the JDev