httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cliff Woolley <cliffwool...@yahoo.com>
Subject Re: [PATCH] performance fix for mod_include
Date Sat, 10 Nov 2001 18:34:30 GMT
On Fri, 9 Nov 2001, Brian Pane wrote:

> This patch zero-fills just the integer and pointer fields in
> the structure, plus the first byte of each of the string buffers.
> With the patch, I'm seeing a 19% improvement in SSI throughput
> in informal testing (ab running a single request at a time,
> over the loopback on Linux).

>+         */
>+        f->ctx = ctx = apr_palloc(f->c->pool, sizeof(*ctx));
>+        memset(f->ctx, 0, (void *)&(ctx->error_str) - (void *)ctx);
>+        ctx->error_str[0] = 0;
>+        ctx->time_str[0] = 0;
>         if (ctx != NULL) {

You can't do arithmetic on void pointers, and you're converting from a
pointer to a size_t without a cast.  I think it should be this:

memset(f->ctx, 0, (size_t)((char *)&(ctx->error_str) - (char *)ctx));

--Cliff


--------------------------------------------------------------
   Cliff Woolley
   cliffwoolley@yahoo.com
   Charlottesville, VA



Mime
View raw message