httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Laurie <...@algroup.co.uk>
Subject Re: cvs commit: httpd-2.0/server config.c
Date Sun, 07 Jan 2001 22:58:56 GMT
Greg Stein wrote:
> 
> On Sun, Jan 07, 2001 at 10:45:26PM -0000, ben@apache.org wrote:
> > ben         01/01/07 14:45:26
> >
> >   Modified:    server   config.c
> >   Log:
> >   Strip trailing stuff from mime types.
> >
> >   Revision  Changes    Path
> >   1.95      +8 -8      httpd-2.0/server/config.c
> >
> >   Index: config.c
> >   ===================================================================
> >   RCS file: /home/cvs/httpd-2.0/server/config.c,v
> >   retrieving revision 1.94
> >   retrieving revision 1.95
> >   diff -u -r1.94 -r1.95
> >   --- config.c        2001/01/07 19:55:58     1.94
> >   +++ config.c        2001/01/07 22:45:26     1.95
> >   @@ -281,26 +281,26 @@
> >        const char *handler;
> >        const char *p;
> >        size_t handler_len;
> >   -    int result = HTTP_INTERNAL_SERVER_ERROR;
> >   +    int result;
> >   +    char hbuf[MAX_STRING_LEN];
> >
> >        if (r->handler) {
> >            handler = r->handler;
> >   -        handler_len = strlen(handler);
> >        }
> >        else {
> >            handler = r->content_type ? r->content_type : ap_default_type(r);
> >   -        if ((p = ap_strchr_c(handler, ';')) != NULL) {
> >   +        if (ap_strchr_c(handler, ';') != NULL) {
> >   +       apr_cpystrn(hbuf, handler, sizeof hbuf);
> >   +       handler = hbuf;
> >   +       p = ap_strchr_c(handler, ';');
> 
> (p - handler) gives you your index into hbuf rather than searching again.

I know.

> 
> >           /* MIME type arguments */
> >                while (p > handler && p[-1] == ' ')
> >               --p;            /* strip trailing spaces */
> >   -       handler_len = p - handler;
> >   +       *p='\0';
> 
> How does this work? p is "const char *".

Good question! My compiler compiles it! What gives?

Cheers,

Ben.

--
http://www.apache-ssl.org/ben.html

"There is no limit to what a man can do or how far he can go if he
doesn't mind who gets the credit." - Robert Woodruff

Mime
View raw message