]> granicus.if.org Git - apache/commitdiff
*) fix inline handling. we had: apr_inline, APR_INLINE, USE_GNU_INLINE, and
authorGreg Stein <gstein@apache.org>
Sat, 24 Feb 2001 11:23:31 +0000 (11:23 +0000)
committerGreg Stein <gstein@apache.org>
Sat, 24 Feb 2001 11:23:31 +0000 (11:23 +0000)
   INLINE. Now, we just have APR_INLINE and APR_HAS_INLINE.
   - convert all usage
   - note that apr_general messed up the defn (compared to apr.h)
   - simplify the inline decision logic in os/*/os.h
   - simplify the code in os/*/os-inline.c

*) toss ap_checkconv() [no longer used]

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@88298 13f79535-47bb-0310-9956-ffa450edef68

17 files changed:
modules/generators/mod_autoindex.c
modules/http/http_core.c
modules/mappers/mod_vhost_alias.c
os/bs2000/os-inline.c
os/bs2000/os.c
os/bs2000/os.h
os/os2/os-inline.c
os/os2/os.h
os/tpf/os-inline.c
os/tpf/os.c
os/tpf/os.h
os/unix/os-inline.c
os/unix/os.h
server/mpm/winnt/mpm_winnt.c
server/scoreboard.c
server/util.c
server/vhost.c

index 8491a3762689e531f39b1a058de5f46f6452bdd9..712b019ee5c79aaaeac5675b4f4332c14b803130 100644 (file)
@@ -184,7 +184,7 @@ static char c_by_encoding, c_by_type, c_by_path;
  * matches ".." or "../").  Hopefully this one call is significantly less
  * expensive than multiple strcmp() calls.
  */
-static apr_inline int is_parent(const char *name)
+static APR_INLINE int is_parent(const char *name)
 {
     /*
      * Now, IFF the first two bytes are dots, and the third byte is either
index f9d306ff282a20f4802d020d6079cf974a58ddf2..50c7e5e2e25443b68753e9a84c97d2fe3ec8d114 100644 (file)
@@ -577,7 +577,7 @@ char *ap_response_code_string(request_rec *r, int error_index)
 
 
 /* Code from Harald Hanche-Olsen <hanche@imf.unit.no> */
-static apr_inline void do_double_reverse (conn_rec *conn)
+static APR_INLINE void do_double_reverse (conn_rec *conn)
 {
     apr_sockaddr_t *sa;
     apr_status_t rv;
index cf93fb31b41fa1c3c0dbdda952c2e979c6d93bdd..09994fb7a4aa9353a5c8485b978eda24eebfb43e 100644 (file)
@@ -276,7 +276,7 @@ static const command_rec mva_commands[] =
  * This really wants to be a nested function
  * but C is too feeble to support them.
  */
-static apr_inline void vhost_alias_checkspace(request_rec *r, char *buf,
+static APR_INLINE void vhost_alias_checkspace(request_rec *r, char *buf,
                                             char **pdest, int size)
 {
     /* XXX: what if size > HUGE_STRING_LEN? */
index 0fdf3b332deeeef82e3c9078dd88dae887c49010..c8299b58acf7107d274d1e424ff89652268be54d 100644 (file)
  * header file and a compilable module.
  *
  * Only inlineable functions should be defined in here. They must all
- * include the INLINE modifier. 
+ * include the APR_INLINE modifier. 
  *
  * If the compiler supports inline, this file will be #included as a
  * header file from os.h to create all the inline function
- * definitions. INLINE will be defined to whatever is required on
+ * definitions. APR_INLINE will be defined to whatever is required on
  * function definitions to make them inline declarations.
  *
  * If the compiler does not support inline, this file will be compiled
  * as a normal C file into libos.a (along with os.c). In this case
- * INLINE will _not_ be set so we can use this to test if we are
- * compiling this source file.  
+ * APR_HAS_INLINE will be zero so we can use this to test if we are
+ * compiling this source file.
  */
 
-#ifndef INLINE
-#define INLINE
-
-/* Anything required only when compiling */
-#include "ap_config.h"
+#include "apr.h"
 
+#if APR_HAS_INLINE
+/* keep inlined functions private to the including file */
+static
 #endif
-
-INLINE int ap_os_is_path_absolute(const char *file)
+APR_INLINE int ap_os_is_path_absolute(const char *file)
 {
-  return (file && file[0] == '/' ? 1 : 0);
+    return file[0] == '/';
 }
index 27d6c22ca93c7825e1cde08f2f1f1bfb6884d63a..63907a43930488052ff456c81e4c484de35e6d47 100644 (file)
  */
 
 #include "httpd.h"
-#include "http_core.h"
 #include "os.h"
-#include "httpd.h"
-
-/* Check the Content-Type to decide if conversion is needed */
-int ap_checkconv(struct request_rec *r)
-{
-    int convert_to_ascii;
-    const char *type;
-
-    /* To make serving of "raw ASCII text" files easy (they serve faster 
-     * since they don't have to be converted from EBCDIC), a new
-     * "magic" type prefix was invented: text/x-ascii-{plain,html,...}
-     * If we detect one of these content types here, we simply correct
-     * the type to the real text/{plain,html,...} type. Otherwise, we
-     * set a flag that translation is required later on.
-     */
-
-    type = (r->content_type == NULL) ? ap_default_type(r) : r->content_type;
-
-    /* If no content type is set then treat it as (ebcdic) text/plain */
-    convert_to_ascii = (type == NULL);
-
-    /* Conversion is applied to text/ files only, if ever. */
-    if (type && (strncasecmp(type, "text/", 5) == 0 ||
-                strncasecmp(type, "message/", 8) == 0)) {
-       if (strncasecmp(type, ASCIITEXT_MAGIC_TYPE_PREFIX,
-                       sizeof(ASCIITEXT_MAGIC_TYPE_PREFIX)-1) == 0)
-           r->content_type = apr_pstrcat(r->pool, "text/",
-                                        type+sizeof(ASCIITEXT_MAGIC_TYPE_PREFIX)-1,
-                                        NULL);
-        else
-           /* translate EBCDIC to ASCII */
-           convert_to_ascii = 1;
-    }
-    /* Enable conversion if it's a text document */
-    ap_bsetflag(r->connection->client, B_EBCDIC2ASCII, convert_to_ascii);
-
-    return convert_to_ascii;
-}
 
 AP_DECLARE(apr_status_t) ap_os_create_privileged_process(
     const request_rec *r,
index ce0f519052dfa527428fa020df05adc227bf1377..d5be0ad7ebbeb9d68152079d87d3aa2fd91e352d 100644 (file)
 
 #define PLATFORM "BS2000"
 
+#include "apr.h"
+
 /*
  * This file in included in all Apache source code. It contains definitions
  * of facilities available on _this_ operating system (HAVE_* macros),
  * and prototypes of OS specific functions defined in os.c or os-inline.c
  */
 
-#if !defined(INLINE) && defined(USE_GNU_INLINE)
+#if APR_HAS_INLINE
 /* Compiler supports inline, so include the inlineable functions as
  * part of the header
  */
-#define INLINE extern apr_inline
-
-INLINE int ap_os_is_path_absolute(const char *file);
 
 #include "os-inline.c"
-#endif
 
-#ifndef INLINE
+#else
 /* Compiler does not support inline, so prototype the inlineable functions
  * as normal
  */
@@ -98,10 +96,6 @@ typedef struct {
 extern int _rini(_rini_struct *);
 #endif /* !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE) */
 
-/* Sorry if this is ugly, but the include order doesn't allow me
- * to use request_rec here... */
-struct request_rec;
-extern int ap_checkconv(struct request_rec *r);
 extern pid_t os_fork(const char *user);
 
 #endif /*! APACHE_OS_H*/
index 68d9a4035d79da5647c324240b2fe5257848cc05..dfcf05cc001366d4da98485d0fc5088431abf4c6 100644 (file)
  * header file and a compilable module.
  *
  * Only inlineable functions should be defined in here. They must all
- * include the INLINE modifier. 
+ * include the APR_INLINE modifier. 
  *
  * If the compiler supports inline, this file will be #included as a
  * header file from os.h to create all the inline function
- * definitions. INLINE will be defined to whatever is required on
+ * definitions. APR_INLINE will be defined to whatever is required on
  * function definitions to make them inline declarations.
  *
  * If the compiler does not support inline, this file will be compiled
  * as a normal C file into libos.a (along with os.c). In this case
- * INLINE will _not_ be set so we can use this to test if we are
- * compiling this source file.  
+ * APR_HAS_INLINE will be zero so we can use this to test if we are
+ * compiling this source file.
  */
 
-#ifndef INLINE
-#define INLINE
-
-/* Anything required only when compiling */
-#include "ap_config.h"
+#include "apr.h"
 
+#if APR_HAS_INLINE
+/* keep inlined functions private to the including file */
+static
 #endif
-
-INLINE int ap_os_is_path_absolute(const char *file)
+APR_INLINE int ap_os_is_path_absolute(const char *file)
 {
-  /* For now, just do the same check that http_request.c and mod_alias.c do. 
-   * XXX: Accept /bleh still?  Or do we concur that d:/bleh is a minimum
-   *      requirement?  If so, canonical name needs to convert to drive/path
-   *      syntax, and the test becomes (file[0] == '/' && file[1] == '/') ||...
-   */
-  return file && (file[0] == '/' || (file[1] == ':' && file[2] == '/'));
+    /* For now, just do the same check that http_request.c and mod_alias.c do. 
+     * XXX: Accept /bleh still?  Or do we concur that d:/bleh is a minimum
+     *      requirement?  If so, canonical name needs to convert to drive/path
+     *      syntax, and the test is (file[0] == '/' && file[1] == '/') ||...
+     */
+    return (file[0] == '/'
+            || (file[0] != '\0' && file[1] == ':' && file[2] == '/'));
 }
index 6199be0c30f5636bb386dc8d8f933ccd53d39b6d..90909271ff85d9b666685b314c6c7585c639033f 100644 (file)
@@ -64,7 +64,8 @@
 #define HAVE_DRIVE_LETTERS
 #define HAVE_UNC_PATHS
 
-#include <apr_general.h>
+#include <apr.h>
+#include <apr_pools.h>
 
 /*
  * This file in included in all Apache source code. It contains definitions
  * and prototypes of OS specific functions defined in os.c or os-inline.c
  */
 
-#if defined(__GNUC__) && !defined(INLINE)
+#if APR_HAS_INLINE
 /* Compiler supports inline, so include the inlineable functions as
  * part of the header
  */
-#define INLINE extern __inline__
-
-INLINE int ap_os_is_path_absolute(const char *file);
 
 #include "os-inline.c"
-#endif
 
-#ifndef INLINE
+#else
 /* Compiler does not support inline, so prototype the inlineable functions
  * as normal
  */
index 0fdf3b332deeeef82e3c9078dd88dae887c49010..c8299b58acf7107d274d1e424ff89652268be54d 100644 (file)
  * header file and a compilable module.
  *
  * Only inlineable functions should be defined in here. They must all
- * include the INLINE modifier. 
+ * include the APR_INLINE modifier. 
  *
  * If the compiler supports inline, this file will be #included as a
  * header file from os.h to create all the inline function
- * definitions. INLINE will be defined to whatever is required on
+ * definitions. APR_INLINE will be defined to whatever is required on
  * function definitions to make them inline declarations.
  *
  * If the compiler does not support inline, this file will be compiled
  * as a normal C file into libos.a (along with os.c). In this case
- * INLINE will _not_ be set so we can use this to test if we are
- * compiling this source file.  
+ * APR_HAS_INLINE will be zero so we can use this to test if we are
+ * compiling this source file.
  */
 
-#ifndef INLINE
-#define INLINE
-
-/* Anything required only when compiling */
-#include "ap_config.h"
+#include "apr.h"
 
+#if APR_HAS_INLINE
+/* keep inlined functions private to the including file */
+static
 #endif
-
-INLINE int ap_os_is_path_absolute(const char *file)
+APR_INLINE int ap_os_is_path_absolute(const char *file)
 {
-  return (file && file[0] == '/' ? 1 : 0);
+    return file[0] == '/';
 }
index 28259deb9c8f78b39f0801dcc1bdbb82dcc6f24c..2181a190b09ff7cb6d34010b1d7b98f145eaf383 100644 (file)
 
 static FILE *sock_fp;
 
-/* Check the Content-Type to decide if conversion is needed */
-int ap_checkconv(struct request_rec *r)
-{
-    int convert_to_ascii;
-    const char *type;
-
-    /* To make serving of "raw ASCII text" files easy (they serve faster 
-     * since they don't have to be converted from EBCDIC), a new
-     * "magic" type prefix was invented: text/x-ascii-{plain,html,...}
-     * If we detect one of these content types here, we simply correct
-     * the type to the real text/{plain,html,...} type. Otherwise, we
-     * set a flag that translation is required later on.
-     */
-
-    type = (r->content_type == NULL) ? ap_default_type(r) : r->content_type;
-
-    /* If no content type is set then treat it as (ebcdic) text/plain */
-    convert_to_ascii = (type == NULL);
-
-    /* Conversion is applied to text/ files only, if ever. */
-    if (type && (strncasecmp(type, "text/", 5) == 0 ||
-                strncasecmp(type, "message/", 8) == 0)) {
-       if (strncasecmp(type, ASCIITEXT_MAGIC_TYPE_PREFIX,
-                        sizeof(ASCIITEXT_MAGIC_TYPE_PREFIX)-1) == 0){
-           r->content_type = apr_pstrcat(r->pool, "text/",
-                   type+sizeof(ASCIITEXT_MAGIC_TYPE_PREFIX)-1, NULL);
-            if (r->method_number == M_PUT)
-                   ap_bsetflag(r->connection->client, B_ASCII2EBCDIC, 0);
-            }
-
-        else
-           /* translate EBCDIC to ASCII */
-           convert_to_ascii = 1;
-    }
-    else{
-           if (r->method_number == M_PUT)
-               ap_bsetflag(r->connection->client, B_ASCII2EBCDIC, 0);
-               /* don't translate non-text files to EBCDIC */
-    }
-    /* Enable conversion if it's a text document */
-    ap_bsetflag(r->connection->client, B_EBCDIC2ASCII, convert_to_ascii);
-
-    return convert_to_ascii;
-}
-
 int tpf_select(int maxfds, fd_set *reads, fd_set *writes, fd_set *excepts, struct timeval *tv)
 {
 /* We're going to force our way through select.  We're only interested reads and TPF allows
index d64a975e6a4b7dfef77ef11d67f5992d591c8d0d..65965c095975a26b1edb34a1676ba79be362103a 100644 (file)
  * and prototypes of OS specific functions defined in os.c or os-inline.c
  */
 
+#include "apr.h"
 #include "ap_config.h"
 
-#if !defined(INLINE) && defined(USE_GNU_INLINE)
+#if APR_HAS_INLINE
 /* Compiler supports inline, so include the inlineable functions as
  * part of the header
  */
-#define INLINE extern apr_inline
+
 #include "os-inline.c"
-#endif
 
-#ifndef INLINE
+#else
 /* Compiler does not support inline, so prototype the inlineable functions
  * as normal
  */
 extern int ap_os_is_path_absolute(const char *f);
 #endif
 
-
-/* Sorry if this is ugly, but the include order doesn't allow me
- * to use request_rec here... */
-struct request_rec;
-extern int ap_checkconv(struct request_rec *r);
  
 #include <strings.h>
 #ifndef __strings_h
index 72a2f8d9efeca62cc6968cd91eaed43b753e2dd0..c8299b58acf7107d274d1e424ff89652268be54d 100644 (file)
  * header file and a compilable module.
  *
  * Only inlineable functions should be defined in here. They must all
- * include the INLINE modifier. 
+ * include the APR_INLINE modifier. 
  *
  * If the compiler supports inline, this file will be #included as a
  * header file from os.h to create all the inline function
- * definitions. INLINE will be defined to whatever is required on
+ * definitions. APR_INLINE will be defined to whatever is required on
  * function definitions to make them inline declarations.
  *
  * If the compiler does not support inline, this file will be compiled
  * as a normal C file into libos.a (along with os.c). In this case
- * INLINE will _not_ be set so we can use this to test if we are
- * compiling this source file.  
+ * APR_HAS_INLINE will be zero so we can use this to test if we are
+ * compiling this source file.
  */
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-
-#ifndef INLINE
-#define INLINE
 
-/* Anything required only when compiling */
-#include "ap_config.h"
+#include "apr.h"
 
+#if APR_HAS_INLINE
+/* keep inlined functions private to the including file */
+static
 #endif
-
-INLINE int ap_os_is_path_absolute(const char *file)
+APR_INLINE int ap_os_is_path_absolute(const char *file)
 {
-  return file[0] == '/';
+    return file[0] == '/';
 }
index f32f92a8eebb24ea18b9933f20020bb64a92eac8..267210d064da76f4f4e838a2dac5a3965e404db6 100644 (file)
@@ -59,6 +59,7 @@
 #ifndef APACHE_OS_H
 #define APACHE_OS_H
 
+#include "apr.h"
 #include "ap_config.h"
 
 #ifndef PLATFORM
  * and prototypes of OS specific functions defined in os.c or os-inline.c
  */
 
-#if !defined(INLINE) && defined(USE_GNU_INLINE)
+
+#if APR_HAS_INLINE
 /* Compiler supports inline, so include the inlineable functions as
  * part of the header
  */
-#define INLINE extern apr_inline
-
-/**
- * Is the path an absolute or relative path
- * @param file The path to the file
- * @return 1 if absolute, 0 otherwise
- * @deffunc int ap_os_is_path_absolute(const char *file)
- */
-INLINE int ap_os_is_path_absolute(const char *file);
 
 #include "os-inline.c"
 
@@ -96,7 +89,15 @@ INLINE int ap_os_is_path_absolute(const char *file);
 /* Compiler does not support inline, so prototype the inlineable functions
  * as normal
  */
+
+/**
+ * Is the path an absolute or relative path
+ * @param file The path to the file
+ * @return 1 if absolute, 0 otherwise
+ * @deffunc int ap_os_is_path_absolute(const char *file)
+ */
 extern int ap_os_is_path_absolute(const char *file);
+
 #endif
 
 /* Other ap_os_ routines not used by this platform */
index c5d829d2c77eec8fbd2d229643cc51d6673ee211..61797356d39f829364da4252fb0dbb599ece4a0c 100644 (file)
@@ -400,7 +400,7 @@ static void sock_disable_nagle(int s)
  */
 static ap_listen_rec *head_listener;
 
-static apr_inline ap_listen_rec *find_ready_listener(fd_set * main_fds)
+static APR_INLINE ap_listen_rec *find_ready_listener(fd_set * main_fds)
 {
     ap_listen_rec *lr;
     SOCKET nsd;
@@ -885,7 +885,7 @@ static int create_acceptex_context(apr_pool_t *_pconf, ap_listen_rec *lr)
 
     return 0;
 }
-static apr_inline apr_status_t reset_acceptex_context(PCOMP_CONTEXT context) 
+static APR_INLINE apr_status_t reset_acceptex_context(PCOMP_CONTEXT context) 
 {
     DWORD BytesRead;
     SOCKET nsd;
index a0cd9baaf927ae399e201dd029b27e5d76068e39..88ebe0fb9ed06f00e5f95f42067d0e96fc4e28a4 100644 (file)
@@ -211,7 +211,7 @@ AP_DECLARE(int) ap_exists_scoreboard_image(void)
     return (ap_scoreboard_image ? 1 : 0);
 }
 
-static apr_inline void put_scoreboard_info(int child_num, int thread_num, 
+static APR_INLINE void put_scoreboard_info(int child_num, int thread_num, 
                                       short_score *new_score_rec)
 {
     /* XXX - needs to be fixed to account for threads */
index b44144e1bd580d6d1273ce295ee1af92722b2446..a3a0be2703aebd726f74fd792104234e8cd357ba 100644 (file)
@@ -1552,7 +1552,7 @@ AP_DECLARE(char *) ap_construct_server(apr_pool_t *p, const char *hostname,
  */
 static const char c2x_table[] = "0123456789abcdef";
 
-static apr_inline unsigned char *c2x(unsigned what, unsigned char *where)
+static APR_INLINE unsigned char *c2x(unsigned what, unsigned char *where)
 {
 #if APR_CHARSET_EBCDIC
     what = apr_xlate_conv_byte(ap_hdrs_to_ascii, (unsigned char)what);
index daaff467d6e9c3d32d71275e620d2840540106b2..ca373e5916ee05407924fca394736ff6c0555159 100644 (file)
@@ -342,13 +342,13 @@ static void dump_iphash_statistics(server_rec *main_s)
  *
  * Hash function provided by David Hankins.
  */
-static apr_inline unsigned hash_inaddr(unsigned key)
+static APR_INLINE unsigned hash_inaddr(unsigned key)
 {
     key ^= (key >> 16);
     return ((key >> 8) ^ key) % IPHASH_TABLE_SIZE;
 }
 
-static apr_inline unsigned hash_addr(struct apr_sockaddr_t *sa)
+static APR_INLINE unsigned hash_addr(struct apr_sockaddr_t *sa)
 {
     unsigned key;
 
@@ -386,7 +386,7 @@ static name_chain *new_name_chain(apr_pool_t *p, server_rec *s, server_addr_rec
 }
 
 
-static apr_inline ipaddr_chain *find_ipaddr(apr_sockaddr_t *sa)
+static APR_INLINE ipaddr_chain *find_ipaddr(apr_sockaddr_t *sa)
 {
     unsigned bucket;
     ipaddr_chain *trav;