Re: [PATCH 3/3] verify_path: consider dos drive prefix
- From
Erik Faye-Lund <kusmabite@gmail.com>
- Date
- May 30, 2011, 11:17 UTC
- Message-ID
- <BANLkTi=o6p=E4bM+CG77yKrFFvQ8sBS07g@mail.gmail.com>
- In-Reply-To
- <C8718F35FD1A4C3C84A4D353D27621E0@martinic.local>
On Mon, May 30, 2011 at 12:58 PM, Theo Niessink <theo@taletn.com> wrote:
Show 12 quoted lines
> Erik Faye-Lund wrote: >> But I think I might have been a bit too care-less; I didn't fix the >> switch-case to check for multiple backslashes on Windows. It's not >> immediately obvious if this is needed or not, but I don't think it can >> cause harm; we should never have created an index like that anyway. >> >> So something like this on top, perhaps? > > Nitpick: If you already know that c != '\0' and !is_dir_sep(c), then why do > continue? It will check for '\0' and is_dir_sep(c) again, but you already > know that both ifs will be false. So you could just as easy jump straight to > c = *path++, which IMHO also makes the code easier to follow:
Very good point, thanks for noticing. I just rewrote the logic from switch/case to if/else, but with the rewrite these redundant compares became more obvious. I think your version is better, indeed.