From 1094e146da57cf0f5f1b3e205055d68708cac156 Mon Sep 17 00:00:00 2001 From: Joseph Carter Date: Thu, 1 Mar 2001 07:42:28 +0000 Subject: [PATCH] COM_SkipPath now uses strrchr, it's much more readable now. --- nq/source/quakefs.c | 12 ++++++------ qw/source/quakefs.c | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/nq/source/quakefs.c b/nq/source/quakefs.c index 487ad3609..b34f99a05 100644 --- a/nq/source/quakefs.c +++ b/nq/source/quakefs.c @@ -985,12 +985,12 @@ COM_SkipPath (char *pathname) { char *last; - last = pathname; - while (*pathname) { - if (*pathname == '/') - last = pathname + 1; - pathname++; - } + // char after last / on the line + if ((last = strrchr (pathname, '/'))) + last++; + else + last = pathname; + return last; } diff --git a/qw/source/quakefs.c b/qw/source/quakefs.c index d48c10494..f24cfe2ee 100644 --- a/qw/source/quakefs.c +++ b/qw/source/quakefs.c @@ -1096,12 +1096,12 @@ COM_SkipPath (char *pathname) { char *last; - last = pathname; - while (*pathname) { - if (*pathname == '/') - last = pathname + 1; - pathname++; - } + // char after last / on the line + if ((last = strrchr (pathname, '/'))) + last++; + else + last = pathname; + return last; }