Commit a728ecba authored by Greg Stein's avatar Greg Stein
Browse files

*) fix inline handling. we had: apr_inline, APR_INLINE, USE_GNU_INLINE, and

   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
parent 3ea17857
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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
+1 −1
Original line number Diff line number Diff line
@@ -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;
+1 −1
Original line number Diff line number Diff line
@@ -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? */
+10 −12
Original line number Diff line number Diff line
@@ -62,28 +62,26 @@
 * 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
 * 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] == '/';
}
+0 −39
Original line number Diff line number Diff line
@@ -62,46 +62,7 @@
 */

#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,
Loading