]> err.no Git - varnish/commitdiff
Cosmetic: redefine HTTP_HDR_* as an enum and rename MAX_HTTP_HDRS to
authordes <des@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Wed, 9 Aug 2006 11:22:55 +0000 (11:22 +0000)
committerdes <des@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Wed, 9 Aug 2006 11:22:55 +0000 (11:22 +0000)
HTTP_HDR_MAX.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@777 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache.h
varnish-cache/bin/varnishd/cache_http.c

index 3eea0c73d22ff842450d6a9ab6f4c676482c1296..0af8339771ee971703dc838a031c3ba349fbafe9 100644 (file)
 #include "common.h"
 #include "miniobj.h"
 
-#define MAX_HTTP_HDRS          32
-
-#define MAX_IOVS               (MAX_HTTP_HDRS * 2)
+enum {
+       HTTP_HDR_REQ,
+       HTTP_HDR_URL,
+       HTTP_HDR_PROTO,
+       HTTP_HDR_STATUS,
+       HTTP_HDR_RESPONSE,
+       /* add more here */
+       HTTP_HDR_FIRST,
+       HTTP_HDR_MAX = 32
+};
 
-#define HTTP_HDR_REQ           0
-#define HTTP_HDR_URL           1
-#define HTTP_HDR_PROTO         2
-#define HTTP_HDR_STATUS                3
-#define HTTP_HDR_RESPONSE      4
-#define HTTP_HDR_FIRST         5
+#define MAX_IOVS       (HTTP_HDR_MAX * 2)
 
 struct cli;
 struct vsb;
@@ -70,7 +72,7 @@ struct http {
                HTTP_Obj
        }                       logtag;
 
-       struct http_hdr         hd[MAX_HTTP_HDRS];
+       struct http_hdr         hd[HTTP_HDR_MAX];
        unsigned                nhd;
 };
 
index 53c6039e3755083144018c3beb73a46c205d19cb..cf9a6df36743137a19ee6105ab9a4349954567e3 100644 (file)
@@ -274,7 +274,7 @@ http_dissect_hdrs(struct http *hp, int fd, char *p)
                    p[2] == '-') 
                        hp->conds = 1;
 
-               if (hp->nhd < MAX_HTTP_HDRS) {
+               if (hp->nhd < HTTP_HDR_MAX) {
                        hp->hd[hp->nhd].b = p;
                        hp->hd[hp->nhd].e = q;
                        VSLH(HTTP_T_Header, fd, hp, hp->nhd);
@@ -573,7 +573,7 @@ http_CopyHttp(struct http *to, struct http *fm)
 static void
 http_seth(int fd, struct http *to, unsigned n, enum httptag tag, const char *fm)
 {
-       assert(n < MAX_HTTP_HDRS);
+       assert(n < HTTP_HDR_MAX);
        assert(fm != NULL);
        to->hd[n].b = (void*)(uintptr_t)fm;
        to->hd[n].e = (void*)(uintptr_t)strchr(fm, '\0');
@@ -584,7 +584,7 @@ static void
 http_copyh(int fd, struct http *to, struct http *fm, unsigned n, enum httptag tag)
 {
 
-       assert(n < MAX_HTTP_HDRS);
+       assert(n < HTTP_HDR_MAX);
        assert(fm->hd[n].b != NULL);
        to->hd[n].b = fm->hd[n].b;
        to->hd[n].e = fm->hd[n].e;
@@ -640,9 +640,9 @@ http_copyheader(int fd, struct http *to, struct http *fm, unsigned n)
 
        CHECK_OBJ_NOTNULL(fm, HTTP_MAGIC);
        CHECK_OBJ_NOTNULL(to, HTTP_MAGIC);
-       assert(n < MAX_HTTP_HDRS);
+       assert(n < HTTP_HDR_MAX);
        assert(fm->hd[n].b != NULL);
-       if (to->nhd < MAX_HTTP_HDRS) {
+       if (to->nhd < HTTP_HDR_MAX) {
                to->hd[to->nhd].b = fm->hd[n].b;
                to->hd[to->nhd].e = fm->hd[n].e;
                VSLH(HTTP_T_Header, fd, to, to->nhd);
@@ -692,7 +692,7 @@ http_SetHeader(int fd, struct http *to, const char *hdr)
 {
 
        CHECK_OBJ_NOTNULL(to, HTTP_MAGIC);
-       if (to->nhd >= MAX_HTTP_HDRS) {
+       if (to->nhd >= HTTP_HDR_MAX) {
                VSL_stats->losthdr++;
                VSL(T(to, HTTP_T_LostHeader), fd, "%s", hdr);
                return;
@@ -712,7 +712,7 @@ http_PrintfHeader(int fd, struct http *to, const char *fmt, ...)
        va_start(ap, fmt);
        l = to->e - to->f;
        n = vsnprintf(to->f, l, fmt, ap);
-       if (n + 1 > l || to->nhd >= MAX_HTTP_HDRS) {
+       if (n + 1 > l || to->nhd >= HTTP_HDR_MAX) {
                VSL_stats->losthdr++;
                VSL(T(to, HTTP_T_LostHeader), fd, "%s", to->f);
        } else {