When VINUMDEBUG is set, add function basename() to return the base

name of a file.  Used by MMalloc and lockdrive.
This commit is contained in:
grog 1999-04-10 08:11:44 +00:00
parent ea5832b2b1
commit 24faa933b9

View File

@ -88,6 +88,19 @@ LongJmp(jmp_buf buf, int retval)
panic("Invalid longjmp");
longjmp(buf, retval);
}
/* find the base name of a path name */
char *
basename(char *file)
{
char *f = rindex(file, '/'); /* chop off dirname if present */
if (f == NULL)
return file;
else
return ++f; /* skip the / */
}
#else
#define LongJmp longjmp /* just use the kernel function */
#endif
@ -145,12 +158,8 @@ MMalloc(int size, char *file, int line)
Debugger("Malloc overlap");
}
if (result) {
char *f = rindex(file, '/'); /* chop off dirname if present */
char *f = basename(file);
if (f == NULL)
f = file;
else
f++; /* skip the / */
i = malloccount++;
total_malloced += size;
microtime(&malloced[i].time);