You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by wr...@apache.org on 2001/02/25 01:51:32 UTC
cvs commit: httpd-2.0/server util.c config.c
wrowe 01/02/24 16:51:32
Modified: include http_config.h
modules/aaa mod_auth.c mod_auth_digest.c
modules/http mod_mime.c
modules/mappers mod_imap.c
server util.c config.c
Log:
Clean up namespace badness with s/configfile_t/ap_configfile_t/
Revision Changes Path
1.70 +16 -24 httpd-2.0/include/http_config.h
Index: http_config.h
===================================================================
RCS file: /home/cvs/httpd-2.0/include/http_config.h,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -r1.69 -r1.70
--- http_config.h 2001/02/23 18:17:15 1.69
+++ http_config.h 2001/02/25 00:51:30 1.70
@@ -254,9 +254,9 @@
*/
#define DECLINE_CMD "\a\b"
-typedef struct configfile_t configfile_t;
+typedef struct ap_configfile_t ap_configfile_t;
/** Common structure for reading of config files / passwd files etc. */
-struct configfile_t {
+struct ap_configfile_t {
/** a getc()-like function
* @deffunc int getch(void *param) */
int (*getch) (void *param);
@@ -290,7 +290,7 @@
ap_method_list_t *xlimited;
/** Config file structure. */
- configfile_t *config_file;
+ ap_configfile_t *config_file;
/** the directive specifying this command */
ap_directive_t *directive;
@@ -593,55 +593,47 @@
AP_DECLARE(module *) ap_find_linked_module(const char *name);
/**
- * Open a configfile_t as apr_file_t
- * @param ret_cfg open configfile_t struct pointer
+ * Open a ap_configfile_t as apr_file_t
+ * @param ret_cfg open ap_configfile_t struct pointer
* @param p The pool to allocate the structure out of
* @param name the name of the file to open
- * @deffunc apr_status_t ap_pcfg_openfile(configfile_t **ret_cfg, apr_pool_t *p, const char *name)
+ * @deffunc apr_status_t ap_pcfg_openfile(ap_configfile_t **ret_cfg, apr_pool_t *p, const char *name)
*/
-AP_DECLARE(apr_status_t) ap_pcfg_openfile(configfile_t **ret_cfg, apr_pool_t *p, const char *name);
+AP_DECLARE(apr_status_t) ap_pcfg_openfile(ap_configfile_t **ret_cfg, apr_pool_t *p, const char *name);
/**
- * Allocate a configfile_t handle with user defined functions and params
+ * Allocate a ap_configfile_t handle with user defined functions and params
* @param p The pool to allocate out of
* @param descr The name of the file
* @param param The argument passed to getch/getstr/close
* @param getc_func The getch function
* @param gets_func The getstr function
* @param close_func The close function
- * @deffunc configfile_t *ap_pcfg_open_custom(apr_pool_t *p, const char *descr, void *param, int(*getc_func)(void*), void *(*gets_func) (void *buf, size_t bufsiz, void *param), int(*close_func)(void *param))
+ * @deffunc ap_configfile_t *ap_pcfg_open_custom(apr_pool_t *p, const char *descr, void *param, int(*getc_func)(void*), void *(*gets_func) (void *buf, size_t bufsiz, void *param), int(*close_func)(void *param))
*/
-AP_DECLARE(configfile_t *) ap_pcfg_open_custom(apr_pool_t *p, const char *descr,
+AP_DECLARE(ap_configfile_t *) ap_pcfg_open_custom(apr_pool_t *p, const char *descr,
void *param,
int(*getc_func)(void*),
void *(*gets_func) (void *buf, size_t bufsiz, void *param),
int(*close_func)(void *param));
/**
- * Read one line from open configfile_t, strip LF, increase line number
+ * Read one line from open ap_configfile_t, strip LF, increase line number
* @param buf place to store the line read
* @param bufsize size of the buffer
* @param cfp File to read from
* @return 1 on success, 0 on failure
- * @deffunc int ap_cfg_getline(char *buf, size_t bufsize, configfile_t *cfp)
+ * @deffunc int ap_cfg_getline(char *buf, size_t bufsize, ap_configfile_t *cfp)
*/
-AP_DECLARE(int) ap_cfg_getline(char *buf, size_t bufsize, configfile_t *cfp);
+AP_DECLARE(int) ap_cfg_getline(char *buf, size_t bufsize, ap_configfile_t *cfp);
/**
- * Read one char from open configfile_t, increase line number upon LF
- * @param cfp The file to read from
- * @return the character read
- * @deffunc int ap_cfg_getc(configfile_t *cfp)
- */
-AP_DECLARE(int) ap_cfg_getc(configfile_t *cfp);
-
-/**
- * Detach from open configfile_t, calling the close handler
+ * Detach from open ap_configfile_t, calling the close handler
* @param cfp The file to close
* @return 1 on sucess, 0 on failure
- * @deffunc int ap_cfg_closefile(configfile_t *cfp)
+ * @deffunc int ap_cfg_closefile(ap_configfile_t *cfp)
*/
-AP_DECLARE(int) ap_cfg_closefile(configfile_t *cfp);
+AP_DECLARE(int) ap_cfg_closefile(ap_configfile_t *cfp);
/**
* Read all data between the current <foo> and the matching </foo>. All
1.33 +2 -2 httpd-2.0/modules/aaa/mod_auth.c
Index: mod_auth.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/aaa/mod_auth.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- mod_auth.c 2001/02/19 02:06:56 1.32
+++ mod_auth.c 2001/02/25 00:51:30 1.33
@@ -127,7 +127,7 @@
static char *get_pw(request_rec *r, char *user, char *auth_pwfile)
{
- configfile_t *f;
+ ap_configfile_t *f;
char l[MAX_STRING_LEN];
const char *rpw, *w;
apr_status_t status;
@@ -154,7 +154,7 @@
static apr_table_t *groups_for_user(apr_pool_t *p, char *user, char *grpfile)
{
- configfile_t *f;
+ ap_configfile_t *f;
apr_table_t *grps = apr_table_make(p, 15);
apr_pool_t *sp;
char l[MAX_STRING_LEN];
1.42 +2 -2 httpd-2.0/modules/aaa/mod_auth_digest.c
Index: mod_auth_digest.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/aaa/mod_auth_digest.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- mod_auth_digest.c 2001/02/22 14:22:39 1.41
+++ mod_auth_digest.c 2001/02/25 00:51:30 1.42
@@ -1340,7 +1340,7 @@
static const char *get_hash(request_rec *r, const char *user,
const char *realm, const char *auth_pwfile)
{
- configfile_t *f;
+ ap_configfile_t *f;
char l[MAX_STRING_LEN];
const char *rpw;
char *w, *x;
@@ -1775,7 +1775,7 @@
static apr_table_t *groups_for_user(request_rec *r, const char *user,
const char *grpfile)
{
- configfile_t *f;
+ ap_configfile_t *f;
apr_table_t *grps = apr_table_make(r->pool, 15);
apr_pool_t *sp;
char l[MAX_STRING_LEN];
1.40 +1 -1 httpd-2.0/modules/http/mod_mime.c
Index: mod_mime.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/http/mod_mime.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- mod_mime.c 2001/02/16 04:26:39 1.39
+++ mod_mime.c 2001/02/25 00:51:31 1.40
@@ -373,7 +373,7 @@
static void mime_post_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s)
{
- configfile_t *f;
+ ap_configfile_t *f;
char l[MAX_STRING_LEN];
int x;
const char *types_confname = ap_get_module_config(s->module_config, &mime_module);
1.30 +1 -1 httpd-2.0/modules/mappers/mod_imap.c
Index: mod_imap.c
===================================================================
RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_imap.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- mod_imap.c 2001/02/16 04:26:40 1.29
+++ mod_imap.c 2001/02/25 00:51:31 1.30
@@ -634,7 +634,7 @@
char *imap_default;
char *imap_base;
- configfile_t *imap;
+ ap_configfile_t *imap;
if (r->method_number != M_GET || (strcmp(r->handler,IMAP_MAGIC_TYPE)
&& strcmp(r->handler, "imap-file")))
1.105 +9 -19 httpd-2.0/server/util.c
Index: util.c
===================================================================
RCS file: /home/cvs/httpd-2.0/server/util.c,v
retrieving revision 1.104
retrieving revision 1.105
diff -u -r1.104 -r1.105
--- util.c 2001/02/24 11:23:22 1.104
+++ util.c 2001/02/25 00:51:32 1.105
@@ -817,7 +817,7 @@
return apr_pstrdup(p,tmp);
}
-AP_DECLARE(int) ap_cfg_closefile(configfile_t *cfp)
+AP_DECLARE(int) ap_cfg_closefile(ap_configfile_t *cfp)
{
#ifdef DEBUG
ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, NULL,
@@ -851,10 +851,10 @@
return NULL;
}
-/* Open a configfile_t as FILE, return open configfile_t struct pointer */
-AP_DECLARE(apr_status_t) ap_pcfg_openfile(configfile_t **ret_cfg, apr_pool_t *p, const char *name)
+/* Open a ap_configfile_t as FILE, return open ap_configfile_t struct pointer */
+AP_DECLARE(apr_status_t) ap_pcfg_openfile(ap_configfile_t **ret_cfg, apr_pool_t *p, const char *name)
{
- configfile_t *new_cfg;
+ ap_configfile_t *new_cfg;
apr_file_t *file = NULL;
apr_finfo_t finfo;
apr_status_t status;
@@ -916,14 +916,14 @@
}
-/* Allocate a configfile_t handle with user defined functions and params */
-AP_DECLARE(configfile_t *) ap_pcfg_open_custom(apr_pool_t *p, const char *descr,
+/* Allocate a ap_configfile_t handle with user defined functions and params */
+AP_DECLARE(ap_configfile_t *) ap_pcfg_open_custom(apr_pool_t *p, const char *descr,
void *param,
int(*getch)(void *param),
void *(*getstr) (void *buf, size_t bufsiz, void *param),
int(*close_func)(void *param))
{
- configfile_t *new_cfg = apr_palloc(p, sizeof(*new_cfg));
+ ap_configfile_t *new_cfg = apr_palloc(p, sizeof(*new_cfg));
#ifdef DEBUG
ap_log_error(APLOG_MARK, APLOG_DEBUG | APLOG_NOERRNO, 0, NULL, "Opening config handler %s", descr);
#endif
@@ -937,19 +937,9 @@
}
-/* Read one character from a configfile_t */
-AP_DECLARE(int) ap_cfg_getc(configfile_t *cfp)
-{
- register int ch = cfp->getch(cfp->param);
- if (ch == LF)
- ++cfp->line_number;
- return ch;
-}
-
-
-/* Read one line from open configfile_t, strip LF, increase line number */
+/* Read one line from open ap_configfile_t, strip LF, increase line number */
/* If custom handler does not define a getstr() function, read char by char */
-AP_DECLARE(int) ap_cfg_getline(char *buf, size_t bufsize, configfile_t *cfp)
+AP_DECLARE(int) ap_cfg_getline(char *buf, size_t bufsize, ap_configfile_t *cfp)
{
/* If a "get string" function is defined, use it */
if (cfp->getstr != NULL) {
1.117 +2 -2 httpd-2.0/server/config.c
Index: config.c
===================================================================
RCS file: /home/cvs/httpd-2.0/server/config.c,v
retrieving revision 1.116
retrieving revision 1.117
diff -u -r1.116 -r1.117
--- config.c 2001/02/23 18:17:16 1.116
+++ config.c 2001/02/25 00:51:32 1.117
@@ -1257,7 +1257,7 @@
cmd_parms parms;
apr_finfo_t finfo;
const char *errmsg;
- configfile_t *cfp;
+ ap_configfile_t *cfp;
fname = ap_server_root_relative(p, fname);
@@ -1384,7 +1384,7 @@
int ap_parse_htaccess(ap_conf_vector_t **result, request_rec *r, int override,
const char *d, const char *access_name)
{
- configfile_t *f = NULL;
+ ap_configfile_t *f = NULL;
cmd_parms parms;
char *filename = NULL;
const struct htaccess_result *cache;
Re: cvs commit: httpd-2.0/server util.c config.c
Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
From: "Greg Stein" <gs...@lyra.org>
Sent: Saturday, February 24, 2001 8:24 PM
> IOW, if you're looking for something to do, then there is a ton of highway
> available :-)
Undoubtedly. My desired patch is simply scanning for FFFE or FEFF (a known
quantity) and preprocessing the cfg text stream through ucs2 to utf8. Pretty
simple, really.
Plus get the get_passwd to work from a service, get shmem up on win32, make Win32
APR a truly LARGE_FILE based schema, rescope processing for daemonizing an app under
APR (so this becomes actually useful and portable code), rescope canonical names so
we fix case-insensitive names bit-by-bit and only as necessary (case doesn't match a
known, already converted quantity like the DocumentRoot, <Directory > or Alias target
names) within the directory_walk function, and clean up the dozens of compiler emits
on Win32. Plus everything I've promised I'd get back to.
I might take a pass on rescoping that for a few months, yet, but thanks for
the offer :-)
Bill
Re: cvs commit: httpd-2.0/server util.c config.c
Posted by Greg Stein <gs...@lyra.org>.
On Sat, Feb 24, 2001 at 07:20:36PM -0600, William A. Rowe, Jr. wrote:
> > wrowe 01/02/24 16:51:32
> >
> > Modified: include http_config.h
> > modules/aaa mod_auth.c mod_auth_digest.c
> > modules/http mod_mime.c
> > modules/mappers mod_imap.c
> > server util.c config.c
> > Log:
> > Clean up namespace badness with s/configfile_t/ap_configfile_t/
>
> This patch does something far more radical, which I believed was already
> committed (a stale util.c seems to have prevented that update, and now the
> update is in this patch.) Sorry.
>
> I ment to depreciate ap_cfg_getc in a seperate patch. It was unused within
> the Apache core, and is near impossible to make sense of in the context of
> any multibyte character encoding (jis, utc-8 etc.)
>
> I'm thoroughly tangled by this code, but I think I'm untangling it finally.
> I've reverted that other patch (depreciate ap_cfg_getc) and I'm probably
> for hiding more details within the internals of ap_cfg_* than actually
> removing this function - which I'm now realizing 3rd party authors may rely
> on ... and my unicode -> utc-8 transform will be just as usable, as long as
> I start a lookahead so they can have it a byte at a time.
I hate all of those functions. They're too tied to the "classic"
configuration file format. And for backwards-compat purposes, we gotta keep
them around in some form or another.
The whole config parsing/reading stuff is still a bit tangled. It is a *lot*
better than before we fixed it last year, but it also has a long ways to go.
A big component of that would be creating modules/config/ and moving all
"classic" config parsing in there. It would always be built into the server
(to appease those who don't like the variability of config files), but the
shift would help to encapsulate/modularize the code. The new classic-config
parsing module could export a header in the same way mod_dav does (that is:
it lives in modules/config and gets copied at install time; the module would
have its own linkage namespace). The core server would assume the module's
existence and always use it for parsing, but it would do so from a "third
party" position of knowing little about what is happening.
More utility functions could be shifted into util_cfgtree.c where they are
not specific to the class format.
Lastly, there would probably be a bit of change to the cmd_parms structure.
There is still a bit of stuff left over in there, which knows about the old
config files.
IOW, if you're looking for something to do, then there is a ton of highway
available :-)
Cheers,
-g
--
Greg Stein, http://www.lyra.org/
Re: cvs commit: httpd-2.0/server util.c config.c
Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
> wrowe 01/02/24 16:51:32
>
> Modified: include http_config.h
> modules/aaa mod_auth.c mod_auth_digest.c
> modules/http mod_mime.c
> modules/mappers mod_imap.c
> server util.c config.c
> Log:
> Clean up namespace badness with s/configfile_t/ap_configfile_t/
This patch does something far more radical, which I believed was already
committed (a stale util.c seems to have prevented that update, and now the
update is in this patch.) Sorry.
I ment to depreciate ap_cfg_getc in a seperate patch. It was unused within
the Apache core, and is near impossible to make sense of in the context of
any multibyte character encoding (jis, utc-8 etc.)
I'm thoroughly tangled by this code, but I think I'm untangling it finally.
I've reverted that other patch (depreciate ap_cfg_getc) and I'm probably
for hiding more details within the internals of ap_cfg_* than actually
removing this function - which I'm now realizing 3rd party authors may rely
on ... and my unicode -> utc-8 transform will be just as usable, as long as
I start a lookahead so they can have it a byte at a time.