serf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Branko ─îibej <br...@apache.org>
Subject Re: svn commit: r1774378 - in /serf/trunk/buckets: hpack_buckets.c log_wrapper_buckets.c mmap_buckets.c ssl_buckets.c
Date Thu, 15 Dec 2016 07:23:53 GMT
On 15.12.2016 08:17, brane@apache.org wrote:

> * buckets/mmap_buckets.c
>   (serf_mmap_read,
>    serf_mmap_readline,
>    serf_mmap_peek): Fix pointer types in output arguments.
[...]
> @@ -87,18 +87,19 @@ static apr_status_t serf_mmap_readline(s
>  {
>      mmap_context_t *ctx = bucket->data;
>      apr_status_t status;
> -    char *end;
> +    const char *eol;
> +    void *end;
>  
>      /* ### Would it be faster to call this once and do the offset ourselves? */
>      status = apr_mmap_offset(&end, ctx->mmap, ctx->offset);
>      if (SERF_BUCKET_READ_ERROR(status))
>          return status;
>  
> -    *data = end;
> +    *data = eol = end;
>  
>      *len = ctx->remaining;
> -    serf_util_readline(&end, len, acceptable, found);
> -    *len = end - *data;
> +    serf_util_readline(&eol, len, acceptable, found);
> +    *len = eol - *data;

I suppose this one might be a wee bit controversial ... any compiler
worth its salt will use lifetime analysis to figure out that it needs a
single stack slot for both 'eol' and 'end'. IMO, using the correct types
here is more valuable than using one less variable at the source level.

-- Brane

Mime
View raw message