Update of /export/home/ntop/ntop
In directory unknown:/tmp/cvs-serv17374
Modified Files:
admin.c config.h.in configure configure.in globals-core.h
initialize.c util.c webInterface.c
Log Message:
Cleanup the #ifdefs for PCAP_ functions.
Consider this the poster child for how code dependent upon specific functions
or operating systems, etc. should be coded (based on recent discussions w/ Luca
and Dinesh).
Instead of this all over mainline routines:
...
#ifdef HAVE_SOMETHING
rc = invokeSomeFunction();
#endif
...
(1) Put the #ifdef in the function, so the main line is clean. If you are
greatly
concerned, then name the function something which gives away it's specific
dependency,
such as reverseSlashesUnderWin32().
This gives a mainline that looks like this:
...
rc = invokeSomeFunction();
...
(2) Code the function so it degrades gracefully or handles the case where the
function isn't available:
static void invokeSomeFunction(void) {
int rc=-1;
#ifdef HAVE_SOMETHING
...
rc = 0;
#else
/* Alternate implementation if xxxx isn't available: */
...
#endif
return(rc);
}
-----Burton (ref 588)
_______________________________________________
Ntop-dev mailing list
[email protected]
http://listgateway.unipi.it/mailman/listinfo/ntop-dev