apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Pane <bp...@pacbell.net>
Subject Re: [PATCH] Make apr_table_elts const
Date Sun, 11 Nov 2001 16:11:13 GMT
Justin Erenkrantz <jerenkrantz@ebuilt.com>Justin Erenkrantz wrote:

[...]

>You missed a few files - namely mod_dav, mod_cgid, and proxy.
>And, you didn't catch all of the instances of apr_table_entry_t 
>now being const (some of them were being casted to 
>apr_table_entry_t, so you didn't catch that they were losing 
>constness?).  The patch below compiles without warnings and
>should achieve your intended result.
>
>This patch should catch all cases *except* for mod_isapi.c.  
>

Thanks for catching that.  Your patch looks good.  Here's a
patch for mod_isapi.c.  I can't test it, though, because I
don't have a win32 compiler.

BTW, what mod_isapi is doing with the array entries is probably
unsafe.  It takes advantage of the fact that apr_table_entry_t
consists of two character pointers and nothing else.  This
code will break if apr_table_entry_t ever gains another field.
That's outside the scope of this particular patch, but it's
probably worth fixing if anyone with a win32 compiler is
interested.

--Brian

Index: modules/arch/win32/mod_isapi.c
===================================================================
RCS file: /home/cvspublic/httpd-2.0/modules/arch/win32/mod_isapi.c,v
retrieving revision 1.50
diff -u -r1.50 mod_isapi.c
--- modules/arch/win32/mod_isapi.c    2001/09/10 03:51:28    1.50
+++ modules/arch/win32/mod_isapi.c    2001/11/11 16:00:08
@@ -567,7 +567,7 @@
         /* lf delimited, colon split, comma seperated and
          * null terminated list of HTTP_ vars
          */
-        char **env = (char**) apr_table_elts(r->subprocess_env)->elts;
+        const char * const *env = (const char* const *) 
apr_table_elts(r->subprocess_env)->elts;
         int nelts = 2 * apr_table_elts(r->subprocess_env)->nelts;
         int i;
 
@@ -601,7 +601,7 @@
         /* lf delimited, colon split, comma seperated and
          * null terminated list of the raw request header
          */
-        char **raw = (char**) apr_table_elts(r->headers_in)->elts;
+        const char * const *raw = (const char* const *) 
apr_table_elts(r->headers_in)->elts;
         int nelts = 2 * apr_table_elts(r->headers_in)->nelts;
         int i;
 




Mime
View raw message