Date: Fri, 7 Mar 2003 07:52:24 -0800 (PST) From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 26492 for review Message-ID: <200303071552.h27FqOwC053307@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=26492 Change 26492 by jhb@jhb_laptop on 2003/03/07 07:52:09 Trim annoying ../'s from the beginning of filenames. Hopefully this will cleanup a few things. Affected files ... .. //depot/projects/smpng/sys/kern/subr_witness.c#84 edit Differences ... ==== //depot/projects/smpng/sys/kern/subr_witness.c#84 (text+ko) ==== @@ -167,6 +167,7 @@ struct witness *oldparent); static void witness_displaydescendants(void(*)(const char *fmt, ...), struct witness *); +static const char *fixup_filename(const char *file); static void witness_leveldescendents(struct witness *parent, int level); static void witness_levelall(void); static struct witness *witness_get(void); @@ -545,6 +546,18 @@ } #endif /* DDB */ +/* Trim useless garbage from filenames. */ +static const char * +fixup_filename(const char *file) +{ + + if (file == NULL) + return (NULL); + while (strncmp(file, "../", 3) == 0) + file += 3; + return (file); +} + void witness_lock(struct lock_object *lock, int flags, const char *file, int line) { @@ -564,6 +577,7 @@ w = lock->lo_witness; class = lock->lo_class; td = curthread; + file = fixup_filename(file); if (class->lc_flags & LC_SLEEPLOCK) { /* @@ -838,6 +852,7 @@ if (lock->lo_witness == NULL || witness_dead || panicstr != NULL) return; class = lock->lo_class; + file = fixup_filename(file); if ((lock->lo_flags & LO_UPGRADABLE) == 0) panic("upgrade of non-upgradable lock (%s) %s @ %s:%d", class->lc_name, lock->lo_name, file, line); @@ -872,6 +887,7 @@ if (lock->lo_witness == NULL || witness_dead || panicstr != NULL) return; class = lock->lo_class; + file = fixup_filename(file); if ((lock->lo_flags & LO_UPGRADABLE) == 0) panic("downgrade of non-upgradable lock (%s) %s @ %s:%d", class->lc_name, lock->lo_name, file, line); @@ -907,6 +923,7 @@ return; td = curthread; class = lock->lo_class; + file = fixup_filename(file); if (class->lc_flags & LC_SLEEPLOCK) lock_list = &td->td_sleeplocks; else @@ -1667,6 +1684,7 @@ lock->lo_class->lc_name, lock->lo_name); return; } + file = fixup_filename(file); switch (flags) { case LA_UNLOCKED: if (instance != NULL) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200303071552.h27FqOwC053307>