Bill Pringlemeir wrote:
> [uploads.c 1.208 : line 1426]
 
>       buf = strchr(buf, '/');
> -     p = buf++;

I wanted to keep the code semantically identical to the previous revision.
However, increasing buf by one is an unnecessary micro-optimization and
I remove it because it might be a little confusing for no real performance
gain whatsoever.

> -     if (!p) {
> +     if (!buf) {

This doesn't change anything because p has value of buf before it's
increased i.e., it's not 0x1 if buf was NULL.

>               g_warning("Invalid encoded Gnutella HTTP URI: %s", uri);
>               upload_error_remove(u, NULL, 400,
>                       "Invalid encoded Gnutella HTTP request");
>               return NULL;
>       }
> +     p = buf++;

(See above.)
 
> To state the obvious, what if "buf" doesn't contain a '/'?

buf will be NULL, so will p. I only increased buf in-place so that it's
a bit easier to see what buf points to. Your version has other advantages
although assigning buf to p is completely redundant since its value is
discarded in the next line of code. I consider this a pure matter of
taste or style.

Nonetheless, I appreciate you're checking the code.
-- 
Christian

Attachment: pgp8MLTf0gzMk.pgp
Description: PGP signature

Reply via email to