extern FILE *debug_log;
-SQUIDCEXTERN const char* SkipBuildPrefix(const char* path);
++const size_t BuildPrefixInit();
++const char * SkipBuildPrefix(const char* path);
++
+
/* Debug stream */
#define debugs(SECTION, LEVEL, CONTENT) \
do { \
"parse_line(char *buff)\n"
"{\n"
"\tchar\t*token;\n"
-- "\tdebugs(0, 10, \"parse_line: \" << buff << \"\\n\" );\n"
"\tif ((token = strtok(buff, w_space)) == NULL) \n"
"\t\treturn 1;\t/* ignore empty lines */\n"
);
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
*
*/
-/* Anyone moving the src/Debug.cc file MUST record its new location here,
- * or there will be issues in the debugging statements, possibly fatal!
- */
-#define RELATIVE_PATH_TO_DEBUG_CC "src/debug.cc"
-
+
#include "config.h"
#include "Debug.h"
#include "SquidTime.h"
}
std::ostringstream (*Debug::CurrentDebug)(NULL);
-static const size_t BuildPrefixInit()
+
- const char *rptdcc=RELATIVE_PATH_TO_DEBUG_CC;
- assert(strstr(file,rptdcc)!=NULL);
- return strlen(file)-strlen(rptdcc);
++const size_t
++BuildPrefixInit()
+ {
++
++ /* Anyone moving the src/Debug.cc file MUST record its new location here,
++ * or there will be issues in the debugging statements, possibly fatal!
++ */
++
++ const char *ThisFileNameTail = "src/debug.cc";
++
+ //leave immediately if misconfigured. Unfortunately not possible to detect at build
+ const char *file=__FILE__;
-static const size_t BuildPrefixLength=BuildPrefixInit();
-const char* SkipBuildPrefix(const char* path)
++ assert(strstr(file,ThisFileNameTail)!=NULL);
++ return strlen(file)-strlen(ThisFileNameTail);
+ }
-
++
++const char*
++SkipBuildPrefix(const char* path)
+ {
++ static const size_t BuildPrefixLength = BuildPrefixInit();
++
+ return path+BuildPrefixLength;
+ }