[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[JDEV] FIX in io.c
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!"