* 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
/* 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;
* 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? */
* 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] == '/';
}
*/
#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,
#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
*/
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*/
* 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] == '/'));
}
#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
*/
* 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] == '/';
}
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
* 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
* 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] == '/';
}
#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"
/* 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 */
*/
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;
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;
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 */
*/
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);
*
* 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;
}
-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;