From d1185107ff6b1704b9a362d3b42bbb2c2292f9a6 Mon Sep 17 00:00:00 2001 From: Jeff Trawick Date: Tue, 20 Jun 2000 11:31:54 +0000 Subject: [PATCH] Use the new command-handler initializer macros in some more modules. Unfortunately, the resulting warnings are *not* all cleaned up. Ten or so warnings spill over to non-AP_DEBUG builds (but that just means that there is a bigger pool of folks to resolve them, right?). git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@85627 13f79535-47bb-0310-9956-ffa450edef68 --- modules/generators/mod_autoindex.c | 72 +++++++++++++++--------------- modules/mappers/mod_alias.c | 50 +++++++++++---------- modules/mappers/mod_dir.c | 7 ++- modules/mappers/mod_imap.c | 20 +++++---- modules/mappers/mod_negotiation.c | 10 ++--- modules/mappers/mod_userdir.c | 6 ++- 6 files changed, 86 insertions(+), 79 deletions(-) diff --git a/modules/generators/mod_autoindex.c b/modules/generators/mod_autoindex.c index 39a467154d..d3932cc718 100644 --- a/modules/generators/mod_autoindex.c +++ b/modules/generators/mod_autoindex.c @@ -232,7 +232,7 @@ static void push_item(ap_array_header_t *arr, char *type, char *to, char *path, } } -static const char *add_alt(cmd_parms *cmd, void *d, char *alt, char *to) +static const char *add_alt(cmd_parms *cmd, void *d, const char *alt, const char *to) { if (cmd->info == BY_PATH) { if (!strcmp(to, "**DIRECTORY**")) { @@ -248,7 +248,7 @@ static const char *add_alt(cmd_parms *cmd, void *d, char *alt, char *to) return NULL; } -static const char *add_icon(cmd_parms *cmd, void *d, char *icon, char *to) +static const char *add_icon(cmd_parms *cmd, void *d, const char *icon, const char *to) { char *iconbak = ap_pstrdup(cmd->pool, icon); @@ -299,7 +299,7 @@ static const char *add_icon(cmd_parms *cmd, void *d, char *icon, char *to) #define WILDCARDS_REQUIRED 0 #endif -static const char *add_desc(cmd_parms *cmd, void *d, char *desc, char *to) +static const char *add_desc(cmd_parms *cmd, void *d, const char *desc, const char *to) { autoindex_config_rec *dcfg = (autoindex_config_rec *) d; ai_desc_t *desc_entry; @@ -322,20 +322,20 @@ static const char *add_desc(cmd_parms *cmd, void *d, char *desc, char *to) return NULL; } -static const char *add_ignore(cmd_parms *cmd, void *d, char *ext) +static const char *add_ignore(cmd_parms *cmd, void *d, const char *ext) { push_item(((autoindex_config_rec *) d)->ign_list, 0, ext, cmd->path, NULL); return NULL; } -static const char *add_header(cmd_parms *cmd, void *d, char *name) +static const char *add_header(cmd_parms *cmd, void *d, const char *name) { push_item(((autoindex_config_rec *) d)->hdr_list, 0, NULL, cmd->path, name); return NULL; } -static const char *add_readme(cmd_parms *cmd, void *d, char *name) +static const char *add_readme(cmd_parms *cmd, void *d, const char *name) { push_item(((autoindex_config_rec *) d)->rdme_list, 0, NULL, cmd->path, name); @@ -498,8 +498,8 @@ static const char *add_opts(cmd_parms *cmd, void *d, const char *optstr) return NULL; } -static const char *set_default_order(cmd_parms *cmd, void *m, char *direction, - char *key) +static const char *set_default_order(cmd_parms *cmd, void *m, const char *direction, + const char *key) { char temp[4]; autoindex_config_rec *d_cfg = (autoindex_config_rec *) m; @@ -544,33 +544,35 @@ static const char *set_default_order(cmd_parms *cmd, void *m, char *direction, static const command_rec autoindex_cmds[] = { - {"AddIcon", add_icon, BY_PATH, DIR_CMD_PERMS, ITERATE2, - "an icon URL followed by one or more filenames"}, - {"AddIconByType", add_icon, BY_TYPE, DIR_CMD_PERMS, ITERATE2, - "an icon URL followed by one or more MIME types"}, - {"AddIconByEncoding", add_icon, BY_ENCODING, DIR_CMD_PERMS, ITERATE2, - "an icon URL followed by one or more content encodings"}, - {"AddAlt", add_alt, BY_PATH, DIR_CMD_PERMS, ITERATE2, - "alternate descriptive text followed by one or more filenames"}, - {"AddAltByType", add_alt, BY_TYPE, DIR_CMD_PERMS, ITERATE2, - "alternate descriptive text followed by one or more MIME types"}, - {"AddAltByEncoding", add_alt, BY_ENCODING, DIR_CMD_PERMS, ITERATE2, - "alternate descriptive text followed by one or more content encodings"}, - {"IndexOptions", add_opts, NULL, DIR_CMD_PERMS, RAW_ARGS, - "one or more index options"}, - {"IndexOrderDefault", set_default_order, NULL, DIR_CMD_PERMS, TAKE2, - "{Ascending,Descending} {Name,Size,Description,Date}"}, - {"IndexIgnore", add_ignore, NULL, DIR_CMD_PERMS, ITERATE, - "one or more file extensions"}, - {"AddDescription", add_desc, BY_PATH, DIR_CMD_PERMS, ITERATE2, - "Descriptive text followed by one or more filenames"}, - {"HeaderName", add_header, NULL, DIR_CMD_PERMS, TAKE1, "a filename"}, - {"ReadmeName", add_readme, NULL, DIR_CMD_PERMS, TAKE1, "a filename"}, - {"FancyIndexing", fancy_indexing, NULL, DIR_CMD_PERMS, FLAG, - "Limited to 'on' or 'off' (superseded by IndexOptions FancyIndexing)"}, - {"DefaultIcon", ap_set_string_slot, - (void *) XtOffsetOf(autoindex_config_rec, default_icon), - DIR_CMD_PERMS, TAKE1, "an icon URL"}, + AP_INIT_ITERATE2("AddIcon", add_icon, BY_PATH, DIR_CMD_PERMS, + "an icon URL followed by one or more filenames"), + AP_INIT_ITERATE2("AddIconByType", add_icon, BY_TYPE, DIR_CMD_PERMS, + "an icon URL followed by one or more MIME types"), + AP_INIT_ITERATE2("AddIconByEncoding", add_icon, BY_ENCODING, DIR_CMD_PERMS, + "an icon URL followed by one or more content encodings"), + AP_INIT_ITERATE2("AddAlt", add_alt, BY_PATH, DIR_CMD_PERMS, + "alternate descriptive text followed by one or more filenames"), + AP_INIT_ITERATE2("AddAltByType", add_alt, BY_TYPE, DIR_CMD_PERMS, + "alternate descriptive text followed by one or more MIME types"), + AP_INIT_ITERATE2("AddAltByEncoding", add_alt, BY_ENCODING, DIR_CMD_PERMS, + "alternate descriptive text followed by one or more content encodings"), + AP_INIT_RAW_ARGS("IndexOptions", add_opts, NULL, DIR_CMD_PERMS, + "one or more index options"), + AP_INIT_TAKE2("IndexOrderDefault", set_default_order, NULL, DIR_CMD_PERMS, + "{Ascending,Descending} {Name,Size,Description,Date}"), + AP_INIT_ITERATE("IndexIgnore", add_ignore, NULL, DIR_CMD_PERMS, + "one or more file extensions"), + AP_INIT_ITERATE2("AddDescription", add_desc, BY_PATH, DIR_CMD_PERMS, + "Descriptive text followed by one or more filenames"), + AP_INIT_TAKE1("HeaderName", add_header, NULL, DIR_CMD_PERMS, + "a filename"), + AP_INIT_TAKE1("ReadmeName", add_readme, NULL, DIR_CMD_PERMS, + "a filename"), + AP_INIT_FLAG("FancyIndexing", fancy_indexing, NULL, DIR_CMD_PERMS, + "Limited to 'on' or 'off' (superseded by IndexOptions FancyIndexing)"), + AP_INIT_TAKE1("DefaultIcon", ap_set_string_slot, + (void *) XtOffsetOf(autoindex_config_rec, default_icon), + DIR_CMD_PERMS, "an icon URL"), {NULL} }; diff --git a/modules/mappers/mod_alias.c b/modules/mappers/mod_alias.c index ce2f2a338c..354caee0bf 100644 --- a/modules/mappers/mod_alias.c +++ b/modules/mappers/mod_alias.c @@ -160,8 +160,8 @@ static const char *add_alias_regex(cmd_parms *cmd, void *dummy, char *f, char *r } static const char *add_redirect_internal(cmd_parms *cmd, alias_dir_conf * dirconf, - char *arg1, char *arg2, char *arg3, - int use_regex) + const char *arg1, const char *arg2, + const char *arg3, int use_regex) { alias_entry *new; server_rec *s = cmd->server; @@ -216,8 +216,8 @@ static const char *add_redirect_internal(cmd_parms *cmd, alias_dir_conf * dircon return NULL; } -static const char *add_redirect(cmd_parms *cmd, alias_dir_conf * dirconf, char *arg1, - char *arg2, char *arg3) +static const char *add_redirect(cmd_parms *cmd, alias_dir_conf * dirconf, + const char *arg1, const char *arg2, const char *arg3) { return add_redirect_internal(cmd, dirconf, arg1, arg2, arg3, 0); } @@ -230,26 +230,28 @@ static const char *add_redirect_regex(cmd_parms *cmd, alias_dir_conf * dirconf, static const command_rec alias_cmds[] = { - {"Alias", add_alias, NULL, RSRC_CONF, TAKE2, - "a fakename and a realname"}, - {"ScriptAlias", add_alias, "cgi-script", RSRC_CONF, TAKE2, - "a fakename and a realname"}, - {"Redirect", add_redirect, (void *) HTTP_MOVED_TEMPORARILY, - OR_FILEINFO, TAKE23, - "an optional status, then document to be redirected and destination URL"}, - {"AliasMatch", add_alias_regex, NULL, RSRC_CONF, TAKE2, - "a regular expression and a filename"}, - {"ScriptAliasMatch", add_alias_regex, "cgi-script", RSRC_CONF, TAKE2, - "a regular expression and a filename"}, - {"RedirectMatch", add_redirect_regex, (void *) HTTP_MOVED_TEMPORARILY, - OR_FILEINFO, TAKE23, - "an optional status, then a regular expression and destination URL"}, - {"RedirectTemp", add_redirect, (void *) HTTP_MOVED_TEMPORARILY, - OR_FILEINFO, TAKE2, - "a document to be redirected, then the destination URL"}, - {"RedirectPermanent", add_redirect, (void *) HTTP_MOVED_PERMANENTLY, - OR_FILEINFO, TAKE2, - "a document to be redirected, then the destination URL"}, + AP_INIT_TAKE2("Alias", add_alias, NULL, RSRC_CONF, + "a fakename and a realname"), + AP_INIT_TAKE2("ScriptAlias", add_alias, "cgi-script", RSRC_CONF, + "a fakename and a realname"), + AP_INIT_TAKE23("Redirect", add_redirect, (void *) HTTP_MOVED_TEMPORARILY, + OR_FILEINFO, + "an optional status, then document to be redirected and " + "destination URL"), + AP_INIT_TAKE2("AliasMatch", add_alias_regex, NULL, RSRC_CONF, + "a regular expression and a filename"), + AP_INIT_TAKE2("ScriptAliasMatch", add_alias_regex, "cgi-script", RSRC_CONF, + "a regular expression and a filename"), + AP_INIT_TAKE23("RedirectMatch", add_redirect_regex, + (void *) HTTP_MOVED_TEMPORARILY, OR_FILEINFO, + "an optional status, then a regular expression and " + "destination URL"), + AP_INIT_TAKE2("RedirectTemp", add_redirect, (void *) HTTP_MOVED_TEMPORARILY, + OR_FILEINFO, + "a document to be redirected, then the destination URL"), + AP_INIT_TAKE2("RedirectPermanent", add_redirect, + (void *) HTTP_MOVED_PERMANENTLY, OR_FILEINFO, + "a document to be redirected, then the destination URL"), {NULL} }; diff --git a/modules/mappers/mod_dir.c b/modules/mappers/mod_dir.c index 4c101a8dd9..2e590170bb 100644 --- a/modules/mappers/mod_dir.c +++ b/modules/mappers/mod_dir.c @@ -78,7 +78,7 @@ typedef struct dir_config_struct { #define DIR_CMD_PERMS OR_INDEXES -static const char *add_index(cmd_parms *cmd, void *dummy, char *arg) +static const char *add_index(cmd_parms *cmd, void *dummy, const char *arg) { dir_config_rec *d = dummy; @@ -91,9 +91,8 @@ static const char *add_index(cmd_parms *cmd, void *dummy, char *arg) static const command_rec dir_cmds[] = { - {"DirectoryIndex", add_index, NULL, - DIR_CMD_PERMS, ITERATE, - "a list of file names"}, + AP_INIT_ITERATE("DirectoryIndex", add_index, NULL, DIR_CMD_PERMS, + "a list of file names"), {NULL} }; diff --git a/modules/mappers/mod_imap.c b/modules/mappers/mod_imap.c index 673e495a88..c803ceb193 100644 --- a/modules/mappers/mod_imap.c +++ b/modules/mappers/mod_imap.c @@ -155,15 +155,17 @@ static void *merge_imap_dir_configs(ap_pool_t *p, void *basev, void *addv) static const command_rec imap_cmds[] = { - {"ImapMenu", ap_set_string_slot, - (void *) XtOffsetOf(imap_conf_rec, imap_menu), OR_INDEXES, TAKE1, - "the type of menu generated: none, formatted, semiformatted, unformatted"}, - {"ImapDefault", ap_set_string_slot, - (void *) XtOffsetOf(imap_conf_rec, imap_default), OR_INDEXES, TAKE1, - "the action taken if no match: error, nocontent, referer, menu, URL"}, - {"ImapBase", ap_set_string_slot, - (void *) XtOffsetOf(imap_conf_rec, imap_base), OR_INDEXES, TAKE1, - "the base for all URL's: map, referer, URL (or start of)"}, + AP_INIT_TAKE1("ImapMenu", ap_set_string_slot, + (void *) XtOffsetOf(imap_conf_rec, imap_menu), OR_INDEXES, + "the type of menu generated: none, formatted, semiformatted, " + "unformatted"), + AP_INIT_TAKE1("ImapDefault", ap_set_string_slot, + (void *) XtOffsetOf(imap_conf_rec, imap_default), OR_INDEXES, + "the action taken if no match: error, nocontent, referer, " + "menu, URL"), + AP_INIT_TAKE1("ImapBase", ap_set_string_slot, + (void *) XtOffsetOf(imap_conf_rec, imap_base), OR_INDEXES, + "the base for all URL's: map, referer, URL (or start of)"), {NULL} }; diff --git a/modules/mappers/mod_negotiation.c b/modules/mappers/mod_negotiation.c index 8873e490b1..51527589ca 100644 --- a/modules/mappers/mod_negotiation.c +++ b/modules/mappers/mod_negotiation.c @@ -108,7 +108,7 @@ static void *merge_neg_dir_configs(ap_pool_t *p, void *basev, void *addv) return new; } -static const char *set_language_priority(cmd_parms *cmd, void *n, char *lang) +static const char *set_language_priority(cmd_parms *cmd, void *n, const char *lang) { ap_array_header_t *arr = ((neg_dir_config *) n)->language_priority; char **langp = (char **) ap_push_array(arr); @@ -134,10 +134,10 @@ static int do_cache_negotiated_docs(server_rec *s) static const command_rec negotiation_cmds[] = { - {"CacheNegotiatedDocs", cache_negotiated_docs, NULL, RSRC_CONF, FLAG, - "Either 'on' or 'off' (default)"}, - {"LanguagePriority", set_language_priority, NULL, OR_FILEINFO, ITERATE, - "space-delimited list of MIME language abbreviations"}, + AP_INIT_FLAG("CacheNegotiatedDocs", cache_negotiated_docs, NULL, RSRC_CONF, + "Either 'on' or 'off' (default)"), + AP_INIT_ITERATE("LanguagePriority", set_language_priority, NULL, OR_FILEINFO, + "space-delimited list of MIME language abbreviations"), {NULL} }; diff --git a/modules/mappers/mod_userdir.c b/modules/mappers/mod_userdir.c index f54fd4400e..911d9e8b2c 100644 --- a/modules/mappers/mod_userdir.c +++ b/modules/mappers/mod_userdir.c @@ -194,8 +194,10 @@ static const char *set_user_dir(cmd_parms *cmd, void *dummy, char *arg) } static const command_rec userdir_cmds[] = { - {"UserDir", set_user_dir, NULL, RSRC_CONF, RAW_ARGS, - "the public subdirectory in users' home directories, or 'disabled', or 'disabled username username...', or 'enabled username username...'"}, + AP_INIT_RAW_ARGS("UserDir", set_user_dir, NULL, RSRC_CONF, + "the public subdirectory in users' home directories, or " + "'disabled', or 'disabled username username...', or " + "'enabled username username...'"), {NULL} }; -- 2.50.1