You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by tr...@locus.apache.org on 2000/08/03 05:09:34 UTC
cvs commit: apache-2.0/src/modules/standard mod_rewrite.c mod_rewrite.h
trawick 00/08/02 20:09:33
Modified: src/modules/standard mod_rewrite.c mod_rewrite.h
Log:
Clean up maintainer-mode compiles of mod_rewrite (use AP_INIT_xx macros
and clean up resulting warnings).
Revision Changes Path
1.37 +51 -41 apache-2.0/src/modules/standard/mod_rewrite.c
Index: mod_rewrite.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_rewrite.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -r1.36 -r1.37
--- mod_rewrite.c 2000/08/02 05:27:17 1.36
+++ mod_rewrite.c 2000/08/03 03:09:31 1.37
@@ -182,25 +182,27 @@
/* the apr_table_t of commands we provide */
static const command_rec command_table[] = {
- { "RewriteEngine", cmd_rewriteengine, NULL, OR_FILEINFO, FLAG,
- "On or Off to enable or disable (default) the whole rewriting engine" },
- { "RewriteOptions", cmd_rewriteoptions, NULL, OR_FILEINFO, ITERATE,
- "List of option strings to set" },
- { "RewriteBase", cmd_rewritebase, NULL, OR_FILEINFO, TAKE1,
- "the base URL of the per-directory context" },
- { "RewriteCond", cmd_rewritecond, NULL, OR_FILEINFO, RAW_ARGS,
- "an input string and a to be applied regexp-pattern" },
- { "RewriteRule", cmd_rewriterule, NULL, OR_FILEINFO, RAW_ARGS,
- "an URL-applied regexp-pattern and a substitution URL" },
- { "RewriteMap", cmd_rewritemap, NULL, RSRC_CONF, TAKE2,
- "a mapname and a filename" },
- { "RewriteLock", cmd_rewritelock, NULL, RSRC_CONF, TAKE1,
- "the filename of a lockfile used for inter-process synchronization"},
- { "RewriteLog", cmd_rewritelog, NULL, RSRC_CONF, TAKE1,
- "the filename of the rewriting logfile" },
- { "RewriteLogLevel", cmd_rewriteloglevel, NULL, RSRC_CONF, TAKE1,
- "the level of the rewriting logfile verbosity "
- "(0=none, 1=std, .., 9=max)" },
+ AP_INIT_FLAG( "RewriteEngine", cmd_rewriteengine, NULL, OR_FILEINFO,
+ "On or Off to enable or disable (default) the whole "
+ "rewriting engine"),
+ AP_INIT_ITERATE( "RewriteOptions", cmd_rewriteoptions, NULL, OR_FILEINFO,
+ "List of option strings to set"),
+ AP_INIT_TAKE1( "RewriteBase", cmd_rewritebase, NULL, OR_FILEINFO,
+ "the base URL of the per-directory context"),
+ AP_INIT_RAW_ARGS("RewriteCond", cmd_rewritecond, NULL, OR_FILEINFO,
+ "an input string and a to be applied regexp-pattern"),
+ AP_INIT_RAW_ARGS("RewriteRule", cmd_rewriterule, NULL, OR_FILEINFO,
+ "an URL-applied regexp-pattern and a substitution URL"),
+ AP_INIT_TAKE2( "RewriteMap", cmd_rewritemap, NULL, RSRC_CONF,
+ "a mapname and a filename"),
+ AP_INIT_TAKE1( "RewriteLock", cmd_rewritelock, NULL, RSRC_CONF,
+ "the filename of a lockfile used for inter-process "
+ "synchronization"),
+ AP_INIT_TAKE1( "RewriteLog", cmd_rewritelog, NULL, RSRC_CONF,
+ "the filename of the rewriting logfile"),
+ AP_INIT_TAKE1( "RewriteLogLevel", cmd_rewriteloglevel, NULL, RSRC_CONF,
+ "the level of the rewriting logfile verbosity "
+ "(0=none, 1=std, .., 9=max)"),
{ NULL }
};
@@ -396,8 +398,9 @@
*/
static const char *cmd_rewriteengine(cmd_parms *cmd,
- rewrite_perdir_conf *dconf, int flag)
+ void *in_dconf, int flag)
{
+ rewrite_perdir_conf *dconf = in_dconf;
rewrite_server_conf *sconf;
sconf =
@@ -415,8 +418,9 @@
}
static const char *cmd_rewriteoptions(cmd_parms *cmd,
- rewrite_perdir_conf *dconf, char *option)
+ void *in_dconf, const char *option)
{
+ rewrite_perdir_conf *dconf = in_dconf;
rewrite_server_conf *sconf;
const char *err;
@@ -436,7 +440,7 @@
}
static const char *cmd_rewriteoptions_setoption(apr_pool_t *p, int *options,
- char *name)
+ const char *name)
{
if (strcasecmp(name, "inherit") == 0) {
*options |= OPTION_INHERIT;
@@ -448,7 +452,7 @@
return NULL;
}
-static const char *cmd_rewritelog(cmd_parms *cmd, void *dconf, char *a1)
+static const char *cmd_rewritelog(cmd_parms *cmd, void *dconf, const char *a1)
{
rewrite_server_conf *sconf;
@@ -460,7 +464,7 @@
return NULL;
}
-static const char *cmd_rewriteloglevel(cmd_parms *cmd, void *dconf, char *a1)
+static const char *cmd_rewriteloglevel(cmd_parms *cmd, void *dconf, const char *a1)
{
rewrite_server_conf *sconf;
@@ -472,8 +476,8 @@
return NULL;
}
-static const char *cmd_rewritemap(cmd_parms *cmd, void *dconf, char *a1,
- char *a2)
+static const char *cmd_rewritemap(cmd_parms *cmd, void *dconf, const char *a1,
+ const char *a2)
{
rewrite_server_conf *sconf;
rewritemap_entry *newmap;
@@ -550,7 +554,7 @@
return NULL;
}
-static const char *cmd_rewritelock(cmd_parms *cmd, void *dconf, char *a1)
+static const char *cmd_rewritelock(cmd_parms *cmd, void *dconf, const char *a1)
{
const char *error;
@@ -562,9 +566,11 @@
return NULL;
}
-static const char *cmd_rewritebase(cmd_parms *cmd, rewrite_perdir_conf *dconf,
- char *a1)
+static const char *cmd_rewritebase(cmd_parms *cmd, void *in_dconf,
+ const char *a1)
{
+ rewrite_perdir_conf *dconf = in_dconf;
+
if (cmd->path == NULL || dconf == NULL) {
return "RewriteBase: only valid in per-directory config files";
}
@@ -580,9 +586,11 @@
return NULL;
}
-static const char *cmd_rewritecond(cmd_parms *cmd, rewrite_perdir_conf *dconf,
- char *str)
+static const char *cmd_rewritecond(cmd_parms *cmd, void *in_dconf,
+ const char *in_str)
{
+ rewrite_perdir_conf *dconf = in_dconf;
+ char *str = apr_pstrdup(cmd->pool, in_str);
rewrite_server_conf *sconf;
rewritecond_entry *newcond;
regex_t *regexp;
@@ -723,9 +731,11 @@
return NULL;
}
-static const char *cmd_rewriterule(cmd_parms *cmd, rewrite_perdir_conf *dconf,
- char *str)
+static const char *cmd_rewriterule(cmd_parms *cmd, void *in_dconf,
+ const char *in_str)
{
+ rewrite_perdir_conf *dconf = in_dconf;
+ char *str = apr_pstrdup(cmd->pool, in_str);
rewrite_server_conf *sconf;
rewriterule_entry *newrule;
regex_t *regexp;
@@ -2900,7 +2910,7 @@
return NULL;
}
-static char *lookup_map_txtfile(request_rec *r, char *file, char *key)
+static char *lookup_map_txtfile(request_rec *r, const char *file, char *key)
{
apr_file_t *fp = NULL;
apr_status_t rc;
@@ -2947,7 +2957,7 @@
}
#ifndef NO_DBM_REWRITEMAP
-static char *lookup_map_dbmfile(request_rec *r, char *file, char *key)
+static char *lookup_map_dbmfile(request_rec *r, const char *file, char *key)
{
DBM *dbmfp = NULL;
datum dbmkey;
@@ -3415,7 +3425,7 @@
}
/* child process code */
-static int rewritemap_program_child(apr_pool_t *p, char *progname,
+static int rewritemap_program_child(apr_pool_t *p, const char *progname,
apr_file_t **fpout, apr_file_t **fpin,
apr_file_t **fperr)
{
@@ -3808,7 +3818,7 @@
return c;
}
-static void set_cache_string(cache *c, char *res, int mode, time_t t,
+static void set_cache_string(cache *c, const char *res, int mode, time_t t,
char *key, char *value)
{
cacheentry ce;
@@ -3820,7 +3830,7 @@
return;
}
-static char *get_cache_string(cache *c, char *res, int mode,
+static char *get_cache_string(cache *c, const char *res, int mode,
time_t t, char *key)
{
cacheentry *ce;
@@ -3886,7 +3896,7 @@
tlb->t[0] = e - elt;
}
-static void store_cache_string(cache *c, char *res, cacheentry *ce)
+static void store_cache_string(cache *c, const char *res, cacheentry *ce)
{
int i;
int j;
@@ -3955,7 +3965,7 @@
return;
}
-static cacheentry *retrieve_cache_string(cache *c, char *res, char *key)
+static cacheentry *retrieve_cache_string(cache *c, const char *res, char *key)
{
int i;
int j;
@@ -3994,7 +4004,7 @@
*/
static char *subst_prefix_path(request_rec *r, char *input, char *match,
- char *subst)
+ const char *subst)
{
char matchbuf[LONG_STRING_LEN];
char substbuf[LONG_STRING_LEN];
1.16 +29 -29 apache-2.0/src/modules/standard/mod_rewrite.h
Index: mod_rewrite.h
===================================================================
RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_rewrite.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- mod_rewrite.h 2000/08/02 05:27:17 1.15
+++ mod_rewrite.h 2000/08/03 03:09:32 1.16
@@ -239,9 +239,9 @@
* and the rewrite rules
*/
typedef struct {
- char *name; /* the name of the map */
- char *datafile; /* filename for map data files */
- char *checkfile; /* filename to check for map existence */
+ const char *name; /* the name of the map */
+ const char *datafile; /* filename for map data files */
+ const char *checkfile; /* filename to check for map existence */
int type; /* the type of the map */
apr_file_t *fpin; /* in file pointer for program maps */
apr_file_t *fpout; /* out file pointer for program maps */
@@ -276,8 +276,8 @@
typedef struct {
int state; /* the RewriteEngine state */
int options; /* the RewriteOption state */
- char *rewritelogfile; /* the RewriteLog filename */
- apr_file_t *rewritelogfp; /* the RewriteLog open filepointer */
+ const char *rewritelogfile; /* the RewriteLog filename */
+ apr_file_t *rewritelogfp; /* the RewriteLog open filepointer */
int rewriteloglevel; /* the RewriteLog level of verbosity */
apr_array_header_t *rewritemaps; /* the RewriteMap entries */
apr_array_header_t *rewriteconds; /* the RewriteCond entries (temporary) */
@@ -295,7 +295,7 @@
apr_array_header_t *rewriteconds; /* the RewriteCond entries (temporary) */
apr_array_header_t *rewriterules; /* the RewriteRule entries */
char *directory; /* the directory where it applies */
- char *baseurl; /* the base-URL where it applies */
+ const char *baseurl; /* the base-URL where it applies */
} rewrite_perdir_conf;
@@ -348,28 +348,28 @@
/* config directive handling */
static const char *cmd_rewriteengine(cmd_parms *cmd,
- rewrite_perdir_conf *dconf, int flag);
+ void *dconf, int flag);
static const char *cmd_rewriteoptions(cmd_parms *cmd,
- rewrite_perdir_conf *dconf,
- char *option);
+ void *dconf,
+ const char *option);
static const char *cmd_rewriteoptions_setoption(apr_pool_t *p, int *options,
- char *name);
-static const char *cmd_rewritelog (cmd_parms *cmd, void *dconf, char *a1);
-static const char *cmd_rewriteloglevel(cmd_parms *cmd, void *dconf, char *a1);
-static const char *cmd_rewritemap (cmd_parms *cmd, void *dconf, char *a1,
- char *a2);
-static const char *cmd_rewritelock(cmd_parms *cmd, void *dconf, char *a1);
-static const char *cmd_rewritebase(cmd_parms *cmd, rewrite_perdir_conf *dconf,
- char *a1);
-static const char *cmd_rewritecond(cmd_parms *cmd, rewrite_perdir_conf *dconf,
- char *str);
+ const char *name);
+static const char *cmd_rewritelog (cmd_parms *cmd, void *dconf, const char *a1);
+static const char *cmd_rewriteloglevel(cmd_parms *cmd, void *dconf, const char *a1);
+static const char *cmd_rewritemap (cmd_parms *cmd, void *dconf,
+ const char *a1, const char *a2);
+static const char *cmd_rewritelock(cmd_parms *cmd, void *dconf, const char *a1);
+static const char *cmd_rewritebase(cmd_parms *cmd, void *dconf,
+ const char *a1);
+static const char *cmd_rewritecond(cmd_parms *cmd, void *dconf,
+ const char *str);
static const char *cmd_rewritecond_parseflagfield(apr_pool_t *p,
rewritecond_entry *new,
char *str);
static const char *cmd_rewritecond_setflag(apr_pool_t *p, rewritecond_entry *cfg,
char *key, char *val);
-static const char *cmd_rewriterule(cmd_parms *cmd, rewrite_perdir_conf *dconf,
- char *str);
+static const char *cmd_rewriterule(cmd_parms *cmd, void *dconf,
+ const char *str);
static const char *cmd_rewriterule_parseflagfield(apr_pool_t *p,
rewriterule_entry *new,
char *str);
@@ -409,9 +409,9 @@
/* rewrite map support functions */
static char *lookup_map(request_rec *r, char *name, char *key);
-static char *lookup_map_txtfile(request_rec *r, char *file, char *key);
+static char *lookup_map_txtfile(request_rec *r, const char *file, char *key);
#ifndef NO_DBM_REWRITEMAP
-static char *lookup_map_dbmfile(request_rec *r, char *file, char *key);
+static char *lookup_map_dbmfile(request_rec *r, const char *file, char *key);
#endif
static char *lookup_map_program(request_rec *r, apr_file_t *fpin,
apr_file_t *fpout, char *key);
@@ -438,7 +438,7 @@
/* program map support */
static void run_rewritemap_programs(server_rec *s, apr_pool_t *p);
-static int rewritemap_program_child(apr_pool_t *p, char *progname,
+static int rewritemap_program_child(apr_pool_t *p, const char *progname,
apr_file_t **fpout, apr_file_t **fpin,
apr_file_t **fperr);
@@ -450,16 +450,16 @@
/* caching functions */
static cache *init_cache(apr_pool_t *p);
-static char *get_cache_string(cache *c, char *res, int mode, time_t mtime,
+static char *get_cache_string(cache *c, const char *res, int mode, time_t mtime,
char *key);
-static void set_cache_string(cache *c, char *res, int mode, time_t mtime,
+static void set_cache_string(cache *c, const char *res, int mode, time_t mtime,
char *key, char *value);
-static cacheentry *retrieve_cache_string(cache *c, char *res, char *key);
-static void store_cache_string(cache *c, char *res, cacheentry *ce);
+static cacheentry *retrieve_cache_string(cache *c, const char *res, char *key);
+static void store_cache_string(cache *c, const char *res, cacheentry *ce);
/* misc functions */
static char *subst_prefix_path(request_rec *r, char *input, char *match,
- char *subst);
+ const char *subst);
static int parseargline(char *str, char **a1, char **a2, char **a3);
static int prefix_stat(const char *path, apr_finfo_t *sb);
static void add_env_variable(request_rec *r, char *s);