Hi,
here are the corresponding patches to solve implementation/alignment
issues with the bitfield used in a shared struct (apr_uri_t ->
request_rec). These problems are occuring if compiling Apache 2.0 for
NetWare (Apache 1.3 also) with various compilers (gcc, Watcom,
CodeWarrior). Changes are designed for "apr-util/include/apr_uri.h" and
"apr-util/uri/apr_uri.c" files. There are some other ways how it could
be changed here, of course - we can use "unsigned long" to store the
flags instead of "unsigned char" here (to alocate space for future use),
define "is_initialized" separately etc. Size of a request_rec struct
(defined in httpd-2.0/include/httpd.h) may be potentially affected by
these changes on some other target platforms (not only on NetWare), so
it's needed to test it on all platforms thoroughly...
Thanks,
Pavel
--- apr_uri.h.orig Sat Oct 27 00:20:20 2001
+++ apr_uri.h Mon Nov 19 14:46:30 2001
@@ -110,6 +110,11 @@
#define APR_URI_UNP_OMITPATHINFO(1U<<4)/* Show "scheme://user@site:port" only */
#define APR_URI_UNP_OMITQUERY (1U<<5)/* Omit the "?queryarg" from the path */
+/* Flags to set some miscelanous things in apr_uri_t struct: */
+#define APR_URI_FLAG_IS_INITIALIZED 0x01
+#define APR_URI_FLAG_DNS_LOOKED_UP 0x02
+#define APR_URI_FLAG_DNS_RESOLVED 0x04
+
typedef struct apr_uri_t apr_uri_t;
/**
@@ -141,14 +146,12 @@
/** The port number, numeric, valid only if port_str != NULL */
apr_port_t port;
-
- /** has the structure been initialized */
- unsigned is_initialized:1;
- /** has the DNS been looked up yet */
- unsigned dns_looked_up:1;
- /** has the dns been resolved yet */
- unsigned dns_resolved:1;
+ /** has the structure been initialized - APR_URI_FLAG_IS_INITIALIZED */
+ /** has the DNS been looked up yet - APR_URI_FLAG_DNS_LOOKED_UP */
+ /** has the dns been resolved yet - APR_URI_FLAG_DNS_RESOLVED */
+
+ unsigned char uri_flags; /* is_initialized, dns_looked_up, dns_resolved, ... */
};
/* apr_uri.c */
--- apr_uri.c.orig Sun Aug 19 18:17:42 2001
+++ apr_uri.c Mon Nov 19 14:21:20 2001
@@ -230,7 +230,7 @@
* can be called more than once per request.
*/
memset (uptr, '\0', sizeof(*uptr));
- uptr->is_initialized = 1;
+ uptr->uri_flags = APR_URI_FLAG_IS_INITIALIZED;
/* We assume the processor has a branch predictor like most --
* it assumes forward branches are untaken and backwards are taken. That's
@@ -353,7 +353,7 @@
* can be called more than once per request.
*/
memset (uptr, '\0', sizeof(*uptr));
- uptr->is_initialized = 1;
+ uptr->uri_flags = APR_URI_FLAG_IS_INITIALIZED;
uptr->hostinfo = apr_pstrdup(p, hostinfo);
/* We expect hostinfo to point to the first character of