You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by André Malo <nd...@perlig.de> on 2004/07/17 17:33:18 UTC

Re: cvs commit: httpd-2.0/modules/filters mod_deflate.c

* niq@apache.org wrote:

>   +        f->ctx = ctx = (void*)-1;

I personally consider defining arbitrary pointer values as bad style, though
I'm not sure what the general opinion here is (if any).

I'd suggest to use a static pointer, like a global

static char foo_sentinel; /* choose a speaking name ;-) */
/* and later */
f->ctx = ctx = &foo_sentinel;

Additionally - afair - the use of arbirtrary pointer values can even lead
to bus errors on not-so-usual systems (loading undefined bits into an address
register...).

nd
-- 
die (eval q-qq[Just Another Perl Hacker
]
;-)
# André Malo, <http://www.perlig.de/> #

Re: cvs commit: httpd-2.0/modules/filters mod_deflate.c

Posted by Nick Kew <ni...@webthing.com>.
On Sat, 17 Jul 2004, [ISO-8859-15] André Malo wrote:

> * niq@apache.org wrote:
>
> >   +        f->ctx = ctx = (void*)-1;
>
> I personally consider defining arbitrary pointer values as bad style, though
> I'm not sure what the general opinion here is (if any).
>
> I'd suggest to use a static pointer, like a global
>
> static char foo_sentinel; /* choose a speaking name ;-) */
> /* and later */
> f->ctx = ctx = &foo_sentinel;
>
> Additionally - afair - the use of arbirtrary pointer values can even lead
> to bus errors on not-so-usual systems (loading undefined bits into an address
> register...).

Yes, you're right.

Actually this patch has a deeper problem, as does the patch it fixes.
Setting the headers at this point depends entirely on the behaviour
of the headers filter.  With current behaviour, the previous mod_deflate
was broken (because it could delay setting headers until after the
headers have been sent down the wire).  With my patch it might still
risk minor breakage (repeated gzip header) if the headers filter changes
sometime in future.

Any more issues with this?  If not I'll make nd's fix and leave it.

-- 
Nick Kew