objects.c and tempbuffer variable

william(at)elan.net william at elan.net
Tue Jun 20 00:29:13 CEST 2006


As far as I can see in objects.c tempbuffer is defined as a static array
of fixed size MAX_INPUT_BUFFER in each and every function with its use
limited to when error needs to be reported. While I understand that you
want it as static array instead of doing malloc as it could produce an
error (and you have no buffer then to use to report it), doing separate
temp_buffer seems very wasteful and increases program size considerably
especially when one needs to increase default MAX_INPUT_BUFFER size.
And in general use of static buffers is not recommended for multi-threaded
programs though I understand in this case it's not a problem as you only
use it during program initialization when its not yet multi-threaded.

I think its reasonable to instead have one global buffer variable
(error_temp_buffer) and have all functions use that instead when doing
error reporting. Even better alternative maybe to use separate function 
or MACRO that would actually do error reporting.

---
William Leibzon
Elan Networks
william at elan.net




More information about the Developers mailing list