> Hi all, > There is something which confuse me. > The xassert function implemented in squid3 in two places, in the file > src/debug.cc and in the lib/assert.c file. Also the assert macro > declared in src/Debug.h file and in the include/assert.h file. > > Is there any reason for these two implementations of xassert function? > > Maybe it was better if the files lib/assert.c and include/assert.h > removed and the assert macro defined in squid.h file like squid2.6 > does...
I think a better approach to this would be: 1) do we actually need it anyway? 2) where is it supposed to be defined? What I'm seeing with the auto-docs work is that a lot of header files include squid.h or protos.h for one or two simple things. That file brings with it a host of type-dependencies, directly or indirectly that clutter up the whole header include process for compiling. I agree with keeping some of the global macros defined in squid.h or defines.h (ie SQUID_MAXHOSTNAMELEN and other boundary squid-wide definitions), but want to see needless dependency removed in the long-term plan. That would involved splitting some of them (like this) out into these assert.h files to be included into places like Debug.h, instead of re-defined there, or adding a dependency of Debug.h on a generic squid.h. _Particularly_ removing all items from the generic squid.h/globals.h/defines.h that add a squid-defined type of any sort. (I know I've been guilty of adding IPAddress there too) If a macro usage is limited to a private .cc file. it would be more appropriate to define it just for that file's compilation and best it go there directly. /rant for the squid-3 plans. 3) can we do any better? Forward-looking, are there any problems with it while its being reviewed that can be fixed now? Amos