objects.c and tempbuffer variable

Ethan Galstad nagios at nagios.org
Wed Jun 21 02:26:48 CEST 2006


william(at)elan.net wrote:
> 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

The good news is that the Nagios CVS HEAD code (pre-3.0) has done away 
with fixed buffer lengths for the processing of config definitions.  I'm 
trying to focus on 3.x, rather than fix a lot of ugliness in 2.x, so 
this will remain a limitation until 3.0 is released.


Ethan Galstad,
Nagios Developer
---
Email: nagios at nagios.org
Website: http://www.nagios.org




More information about the Developers mailing list