[Nagiosplug-devel] replacing common system calls with macros/inlines?

sean finney seanius at seanius.net
Tue Mar 21 14:55:07 CET 2006

a thought for consideration:

currently, there are a large number of places in plugin code
where we have stuff like

	if(foo==NULL) {
		printf("error message");

does it make any sense to introduce some macros to condense
code a bit?  for example:

	static inline char* STRDUP(const char *foo){
		char *bar;
			printf("error message");

and then everywhere in our plugin code we could replace the strdup()+error
detection calls with STRDUP(), and save ourselves some lines of code in
many places (and introduce missing/needed error checking in others).

likewise, a similar approach could be taken for malloc, fopen, and
probably others...

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <https://www.monitoring-plugins.org/archive/devel/attachments/20060321/2017938d/attachment.sig>

More information about the Devel mailing list