ianh 01/11/11 14:31:04
Modified: modules/arch/win32 mod_isapi.c
modules/dav/main mod_dav.c
modules/filters mod_include.c
modules/generators mod_cgi.c mod_cgid.c
modules/http http_request.c
modules/mappers mod_rewrite.c
modules/metadata mod_env.c mod_setenvif.c
modules/proxy proxy_http.c
server util_script.c
include apr_tables.h
Log:
This patch changes the apr_table_elts macro so that it provides
access to the internals of an apr_table_t via a const pointer
instead of the current non-const pointer.
Submitted by: Brian Pane <[EMAIL PROTECTED]>
Reviewed by: Ian Holsman
Revision Changes Path
1.51 +2 -2 httpd-2.0/modules/arch/win32/mod_isapi.c
Index: mod_isapi.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/arch/win32/mod_isapi.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- mod_isapi.c 2001/09/10 03:51:28 1.50
+++ mod_isapi.c 2001/11/11 22:31:03 1.51
@@ -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;
1.64 +6 -6 httpd-2.0/modules/dav/main/mod_dav.c
Index: mod_dav.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/dav/main/mod_dav.c,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -r1.63 -r1.64
--- mod_dav.c 2001/11/02 19:25:50 1.63
+++ mod_dav.c 2001/11/11 22:31:03 1.64
@@ -1216,8 +1216,8 @@
const apr_table_t *methods,
ap_text_header *body)
{
- apr_array_header_t *arr;
- apr_table_entry_t *elts;
+ const apr_array_header_t *arr;
+ const apr_table_entry_t *elts;
ap_xml_elem *child;
ap_xml_attr *attr;
char *s;
@@ -1228,7 +1228,7 @@
if (elem->first_child == NULL) {
/* show all supported methods */
arr = apr_table_elts(methods);
- elts = (apr_table_entry_t *) arr->elts;
+ elts = (const apr_table_entry_t *) arr->elts;
for (i = 0; i < arr->nelts; ++i) {
if (elts[i].key == NULL)
@@ -1459,8 +1459,8 @@
const char *dav_level;
char *allow;
char *s;
- apr_array_header_t *arr;
- apr_table_entry_t *elts;
+ const apr_array_header_t *arr;
+ const apr_table_entry_t *elts;
apr_table_t *methods = apr_table_make(r->pool, 12);
ap_text_header vsn_options = { 0 };
ap_text_header body = { 0 };
@@ -1641,7 +1641,7 @@
/* Generate the Allow header */
arr = apr_table_elts(methods);
- elts = (apr_table_entry_t *) arr->elts;
+ elts = (const apr_table_entry_t *) arr->elts;
text_size = 0;
/* first, compute total length */
1.152 +2 -2 httpd-2.0/modules/filters/mod_include.c
Index: mod_include.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/filters/mod_include.c,v
retrieving revision 1.151
retrieving revision 1.152
diff -u -r1.151 -r1.152
--- mod_include.c 2001/11/11 22:12:25 1.151
+++ mod_include.c 2001/11/11 22:31:03 1.152
@@ -2609,8 +2609,8 @@
if (ctx->flags & FLAG_PRINTING) {
ap_ssi_get_tag_and_value(ctx, &tag, &tag_val, 1);
if ((tag == NULL) && (tag_val == NULL)) {
- apr_array_header_t *arr = apr_table_elts(r->subprocess_env);
- apr_table_entry_t *elts = (apr_table_entry_t *)arr->elts;
+ const apr_array_header_t *arr =
apr_table_elts(r->subprocess_env);
+ const apr_table_entry_t *elts = (const apr_table_entry_t
*)arr->elts;
int i;
const char *key_text, *val_text;
apr_size_t k_len, v_len, t_wrt;
1.107 +3 -3 httpd-2.0/modules/generators/mod_cgi.c
Index: mod_cgi.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/generators/mod_cgi.c,v
retrieving revision 1.106
retrieving revision 1.107
diff -u -r1.106 -r1.107
--- mod_cgi.c 2001/09/18 03:33:30 1.106
+++ mod_cgi.c 2001/11/11 22:31:03 1.107
@@ -257,8 +257,8 @@
char *dbuf, const char *sbuf, apr_file_t *script_in,
apr_file_t *script_err)
{
- apr_array_header_t *hdrs_arr = apr_table_elts(r->headers_in);
- apr_table_entry_t *hdrs = (apr_table_entry_t *) hdrs_arr->elts;
+ const apr_array_header_t *hdrs_arr = apr_table_elts(r->headers_in);
+ const apr_table_entry_t *hdrs = (const apr_table_entry_t *)
hdrs_arr->elts;
char argsbuffer[HUGE_STRING_LEN];
apr_file_t *f = NULL;
int i;
@@ -300,7 +300,7 @@
apr_file_puts("%response\n", f);
hdrs_arr = apr_table_elts(r->err_headers_out);
- hdrs = (apr_table_entry_t *) hdrs_arr->elts;
+ hdrs = (const apr_table_entry_t *) hdrs_arr->elts;
for (i = 0; i < hdrs_arr->nelts; ++i) {
if (!hdrs[i].key)
1.101 +3 -3 httpd-2.0/modules/generators/mod_cgid.c
Index: mod_cgid.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/generators/mod_cgid.c,v
retrieving revision 1.100
retrieving revision 1.101
diff -u -r1.100 -r1.101
--- mod_cgid.c 2001/11/11 16:48:26 1.100
+++ mod_cgid.c 2001/11/11 22:31:03 1.101
@@ -749,8 +749,8 @@
static int log_script(request_rec *r, cgid_server_conf * conf, int ret,
char *dbuf, const char *sbuf, apr_file_t *script_in,
apr_file_t *script_err)
{
- apr_array_header_t *hdrs_arr = apr_table_elts(r->headers_in);
- apr_table_entry_t *hdrs = (apr_table_entry_t *) hdrs_arr->elts;
+ const apr_array_header_t *hdrs_arr = apr_table_elts(r->headers_in);
+ const apr_table_entry_t *hdrs = (apr_table_entry_t *) hdrs_arr->elts;
char argsbuffer[HUGE_STRING_LEN];
apr_file_t *f = NULL;
int i;
@@ -795,7 +795,7 @@
apr_file_puts("%response\n", f);
hdrs_arr = apr_table_elts(r->err_headers_out);
- hdrs = (apr_table_entry_t *) hdrs_arr->elts;
+ hdrs = (const apr_table_entry_t *) hdrs_arr->elts;
for (i = 0; i < hdrs_arr->nelts; ++i) {
if (!hdrs[i].key)
1.118 +2 -2 httpd-2.0/modules/http/http_request.c
Index: http_request.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/http/http_request.c,v
retrieving revision 1.117
retrieving revision 1.118
diff -u -r1.117 -r1.118
--- http_request.c 2001/10/30 19:21:41 1.117
+++ http_request.c 2001/11/11 22:31:03 1.118
@@ -310,8 +310,8 @@
static apr_table_t *rename_original_env(apr_pool_t *p, apr_table_t *t)
{
- apr_array_header_t *env_arr = apr_table_elts(t);
- apr_table_entry_t *elts = (apr_table_entry_t *) env_arr->elts;
+ const apr_array_header_t *env_arr = apr_table_elts(t);
+ const apr_table_entry_t *elts = (const apr_table_entry_t *)
env_arr->elts;
apr_table_t *new = apr_table_make(p, env_arr->nalloc);
int i;
1.86 +3 -3 httpd-2.0/modules/mappers/mod_rewrite.c
Index: mod_rewrite.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_rewrite.c,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -r1.85 -r1.86
--- mod_rewrite.c 2001/10/21 17:56:36 1.85
+++ mod_rewrite.c 2001/11/11 22:31:04 1.86
@@ -3627,12 +3627,12 @@
static char *lookup_header(request_rec *r, const char *name)
{
- apr_array_header_t *hdrs_arr;
- apr_table_entry_t *hdrs;
+ const apr_array_header_t *hdrs_arr;
+ const apr_table_entry_t *hdrs;
int i;
hdrs_arr = apr_table_elts(r->headers_in);
- hdrs = (apr_table_entry_t *)hdrs_arr->elts;
+ hdrs = (const apr_table_entry_t *)hdrs_arr->elts;
for (i = 0; i < hdrs_arr->nelts; ++i) {
if (hdrs[i].key == NULL) {
continue;
1.26 +4 -4 httpd-2.0/modules/metadata/mod_env.c
Index: mod_env.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/metadata/mod_env.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- mod_env.c 2001/10/21 01:17:11 1.25
+++ mod_env.c 2001/11/11 22:31:04 1.26
@@ -92,8 +92,8 @@
env_dir_config_rec *add = addv;
env_dir_config_rec *res = apr_palloc(p, sizeof(*res));
- apr_table_entry_t *elts;
- apr_array_header_t *arr;
+ const apr_table_entry_t *elts;
+ const apr_array_header_t *arr;
int i;
@@ -111,14 +111,14 @@
res->unsetenv = NULL;
arr = apr_table_elts(add->unsetenv);
- elts = (apr_table_entry_t *)arr->elts;
+ elts = (const apr_table_entry_t *)arr->elts;
for (i = 0; i < arr->nelts; ++i) {
apr_table_unset(res->vars, elts[i].key);
}
arr = apr_table_elts(add->vars);
- elts = (apr_table_entry_t *)arr->elts;
+ elts = (const apr_table_entry_t *)arr->elts;
for (i = 0; i < arr->nelts; ++i) {
apr_table_setn(res->vars, elts[i].key, elts[i].val);
1.31 +5 -5 httpd-2.0/modules/metadata/mod_setenvif.c
Index: mod_setenvif.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/metadata/mod_setenvif.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- mod_setenvif.c 2001/06/12 17:06:01 1.30
+++ mod_setenvif.c 2001/11/11 22:31:04 1.31
@@ -406,7 +406,7 @@
{
sei_cfg_rec *sconf;
sei_entry *entries;
- apr_table_entry_t *elts;
+ const apr_table_entry_t *elts;
const char *val;
int i, j;
char *last_name;
@@ -459,8 +459,8 @@
* the headers_in until we find a match or run out of
* headers.
*/
- apr_array_header_t *arr = apr_table_elts(r->headers_in);
- elts = (apr_table_entry_t *) arr->elts;
+ const apr_array_header_t *arr =
apr_table_elts(r->headers_in);
+ elts = (const apr_table_entry_t *) arr->elts;
val = NULL;
for (j = 0; j < arr->nelts; ++j) {
if (!ap_regexec(b->pnamereg, elts[j].key, 0, NULL,
0)) {
@@ -489,8 +489,8 @@
}
if (!ap_regexec(b->preg, val, 0, NULL, 0)) {
- apr_array_header_t *arr = apr_table_elts(b->features);
- elts = (apr_table_entry_t *) arr->elts;
+ const apr_array_header_t *arr = apr_table_elts(b->features);
+ elts = (const apr_table_entry_t *) arr->elts;
for (j = 0; j < arr->nelts; ++j) {
if (!strcmp(elts[j].val, "!")) {
1.107 +3 -3 httpd-2.0/modules/proxy/proxy_http.c
Index: proxy_http.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/proxy/proxy_http.c,v
retrieving revision 1.106
retrieving revision 1.107
diff -u -r1.106 -r1.107
--- proxy_http.c 2001/11/05 23:06:55 1.106
+++ proxy_http.c 2001/11/11 22:31:04 1.107
@@ -448,8 +448,8 @@
char buffer[HUGE_STRING_LEN];
char *buf;
apr_bucket *e;
- apr_array_header_t *headers_in_array;
- apr_table_entry_t *headers_in;
+ const apr_array_header_t *headers_in_array;
+ const apr_table_entry_t *headers_in;
int counter;
/*
* Send the HTTP/1.1 request to the remote server
@@ -551,7 +551,7 @@
/* send request headers */
headers_in_array = apr_table_elts(r->headers_in);
- headers_in = (apr_table_entry_t *) headers_in_array->elts;
+ headers_in = (const apr_table_entry_t *) headers_in_array->elts;
for (counter = 0; counter < headers_in_array->nelts; counter++) {
if (headers_in[counter].key == NULL || headers_in[counter].val ==
NULL
1.66 +4 -4 httpd-2.0/server/util_script.c
Index: util_script.c
===================================================================
RCS file: /home/cvs/httpd-2.0/server/util_script.c,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -r1.65 -r1.66
--- util_script.c 2001/11/10 18:38:02 1.65
+++ util_script.c 2001/11/11 22:31:04 1.66
@@ -122,8 +122,8 @@
AP_DECLARE(char **) ap_create_environment(apr_pool_t *p, apr_table_t *t)
{
- apr_array_header_t *env_arr = apr_table_elts(t);
- apr_table_entry_t *elts = (apr_table_entry_t *) env_arr->elts;
+ const apr_array_header_t *env_arr = apr_table_elts(t);
+ const apr_table_entry_t *elts = (const apr_table_entry_t *)
env_arr->elts;
char **env = (char **) apr_palloc(p, (env_arr->nelts + 2) * sizeof(char
*));
int i, j;
char *tz;
@@ -169,8 +169,8 @@
char *env_temp;
#endif
const char *host;
- apr_array_header_t *hdrs_arr = apr_table_elts(r->headers_in);
- apr_table_entry_t *hdrs = (apr_table_entry_t *) hdrs_arr->elts;
+ const apr_array_header_t *hdrs_arr = apr_table_elts(r->headers_in);
+ const apr_table_entry_t *hdrs = (const apr_table_entry_t *)
hdrs_arr->elts;
int i;
apr_port_t rport;
apr_sockaddr_t *remotesa;
1.24 +1 -1 apr/include/apr_tables.h
Index: apr_tables.h
===================================================================
RCS file: /home/cvs/apr/include/apr_tables.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- apr_tables.h 2001/08/24 17:55:45 1.23
+++ apr_tables.h 2001/11/11 22:31:04 1.24
@@ -137,7 +137,7 @@
* @param t The table
* @return An array containing the contents of the table
*/
-#define apr_table_elts(t) ((apr_array_header_t *)(t))
+#define apr_table_elts(t) ((const apr_array_header_t *)(t))
/**
* Determine if the table is empty