diff options
| author | Greg Lehey <grog@FreeBSD.org> | 1999-04-10 08:11:44 +0000 |
|---|---|---|
| committer | Greg Lehey <grog@FreeBSD.org> | 1999-04-10 08:11:44 +0000 |
| commit | ff17305f576bb71e8ef8b90c5be0c51b31c2c725 (patch) | |
| tree | 6b2b752f545a131da4c14485a83d965e40cc04a4 /sys | |
| parent | 7ffb59f668dc25287a9140edfbacf285230f3bce (diff) | |
Notes
Diffstat (limited to 'sys')
| -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 a20b2b03f01d3..f0663108f2afe 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); |
