Commit 507b27bf authored by Joe Orton's avatar Joe Orton
Browse files

* modules/filters/mod_proxy_html.c: Fix various code style issues. Use

  apr_is* ctype macro wrappers.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1200556 13f79535-47bb-0310-9956-ffa450edef68
parent 3236b2c4
Loading
Loading
Loading
Loading
+146 −136
Original line number Diff line number Diff line
@@ -29,8 +29,6 @@
#define VERBOSEB(x) if (verbose) {x}
#endif

#include <ctype.h>

/* libxml2 */
#include <libxml/HTMLparser.h>

@@ -40,6 +38,7 @@
#include "apr_strings.h"
#include "apr_hash.h"
#include "apr_strmatch.h"
#include "apr_lib.h"

#include "apr_optional.h"
#include "mod_xml2enc.h"
@@ -171,6 +170,7 @@ static void pcharacters(void* ctxt, const xmlChar *uchars, int length)
    }
    FLUSH;
}

static void preserve(saxctxt *ctx, const size_t len)
{
    char *newbuf;
@@ -189,12 +189,14 @@ static void preserve(saxctxt* ctx, const size_t len)
        ctx->buf = newbuf;
    }
}

static void pappend(saxctxt *ctx, const char *buf, const size_t len)
{
    preserve(ctx, len);
    memcpy(ctx->buf+ctx->offset, buf, len);
    ctx->offset += len;
}

static void dump_content(saxctxt *ctx)
{
    urlmap *m;
@@ -338,6 +340,7 @@ static void pendElement(void* ctxt, const xmlChar* uname)
        ap_fprintf(ctx->f->next, ctx->bb, "</%s>", name);
    }
}

static void pstartElement(void *ctxt, const xmlChar *uname,
                          const xmlChar** uattrs)
{
@@ -654,8 +657,8 @@ static meta* metafix(request_rec* r, const char* buf)
        header = NULL;
        content = NULL;
        p = buf+offs+pmatch[1].rm_eo;
        while (!isalpha(*++p));
        for (q = p; isalnum(*q) || (*q == '-'); ++q);
        while (!apr_isalpha(*++p));
        for (q = p; apr_isalnum(*q) || (*q == '-'); ++q);
        header = apr_pstrndup(r->pool, p, q-p);
        if (strncasecmp(header, "Content-", 8)) {
            /* find content=... string */
@@ -665,16 +668,16 @@ static meta* metafix(request_rec* r, const char* buf)
            if (p != NULL) {
                while (*p) {
                    p += 7;
                    while (*p && isspace(*p))
                    while (*p && apr_isspace(*p))
                        ++p;
                    if (*p != '=')
                        continue;
                    while (*p && isspace(*++p));
                    while (*p && apr_isspace(*++p));
                    if ((*p == '\'') || (*p == '"')) {
                        delim = *p++;
                        for (q = p; *q != delim; ++q);
                    } else {
                        for (q = p; *q && !isspace(*q) && (*q != '>'); ++q);
                        for (q = p; *q && !apr_isspace(*q) && (*q != '>'); ++q);
                    }
                    content = apr_pstrndup(r->pool, p, q-p);
                    break;
@@ -787,6 +790,7 @@ static void fixup_rules(saxctxt* ctx)
    if (prev)
        prev->next = NULL;
}

static saxctxt *check_filter_init (ap_filter_t *f)
{
    saxctxt *fctx;
@@ -839,6 +843,7 @@ static saxctxt* check_filter_init (ap_filter_t* f)
    }
    return f->ctx;
}

static int proxy_html_filter(ap_filter_t *f, apr_bucket_brigade *bb)
{
    apr_bucket* b;
@@ -956,6 +961,7 @@ static void* proxy_html_config(apr_pool_t* pool, char* x)
    /* don't initialise links and events until they get set/used */
    return ret;
}

static void *proxy_html_merge(apr_pool_t *pool, void *BASE, void *ADD)
{
    proxy_html_conf *base = (proxy_html_conf *) BASE;
@@ -1067,6 +1073,7 @@ static const char* comp_urlmap(cmd_parms *cmd, urlmap* newmap,
    }
    return err;
}

static const char *set_urlmap(cmd_parms *cmd, void *CFG, const char *args)
{
    proxy_html_conf *cfg = (proxy_html_conf *)CFG;
@@ -1130,6 +1137,7 @@ static const char* set_doctype(cmd_parms* cmd, void* CFG,
    }
    return NULL;
}

static const char *set_flags(cmd_parms *cmd, void *CFG, const char *arg)
{
    proxy_html_conf *cfg = CFG;
@@ -1143,6 +1151,7 @@ static const char* set_flags(cmd_parms* cmd, void* CFG, const char* arg)
    }
    return NULL;
}

static const char *set_events(cmd_parms *cmd, void *CFG, const char *arg)
{
    tattr *attr;
@@ -1153,6 +1162,7 @@ static const char* set_events(cmd_parms* cmd, void* CFG, const char* arg)
    attr->val = arg;
    return NULL;
}

static const char *set_links(cmd_parms *cmd, void *CFG,
                             const char *elt, const char *att)
{