diff options
author | grog <grog@FreeBSD.org> | 1999-04-10 08:11:44 +0000 |
---|---|---|
committer | grog <grog@FreeBSD.org> | 1999-04-10 08:11:44 +0000 |
commit | a69fe8289448367e85f6e6bc4cb96d077d23f9be (patch) | |
tree | 39b0917fb5493e49cb80a63f5e1e2f2f6b890ba4 /sys/dev | |
parent | 3053fd36c3930abc3f05b75691681bfd3828dd76 (diff) | |
download | FreeBSD-src-a69fe8289448367e85f6e6bc4cb96d077d23f9be.zip FreeBSD-src-a69fe8289448367e85f6e6bc4cb96d077d23f9be.tar.gz |
When VINUMDEBUG is set, add function basename() to return the base
name of a file. Used by MMalloc and lockdrive.
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/vinum/vinummemory.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/sys/dev/vinum/vinummemory.c b/sys/dev/vinum/vinummemory.c index a20b2b0..f066310 100644 --- a/sys/dev/vinum/vinummemory.c +++ b/sys/dev/vinum/vinummemory.c @@ -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); |