r777 - trunk/varnish-cache/bin/varnishd

des at projects.linpro.no des at projects.linpro.no
Wed Aug 9 13:22:55 CEST 2006


Author: des
Date: 2006-08-09 13:22:55 +0200 (Wed, 09 Aug 2006)
New Revision: 777

Modified:
   trunk/varnish-cache/bin/varnishd/cache.h
   trunk/varnish-cache/bin/varnishd/cache_http.c
Log:
Cosmetic: redefine HTTP_HDR_* as an enum and rename MAX_HTTP_HDRS to
HTTP_HDR_MAX.

Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h	2006-08-09 09:36:29 UTC (rev 776)
+++ trunk/varnish-cache/bin/varnishd/cache.h	2006-08-09 11:22:55 UTC (rev 777)
@@ -17,17 +17,19 @@
 #include "common.h"
 #include "miniobj.h"
 
-#define MAX_HTTP_HDRS		32
+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 MAX_IOVS		(MAX_HTTP_HDRS * 2)
+#define MAX_IOVS	(HTTP_HDR_MAX * 2)
 
-#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
-
 struct cli;
 struct vsb;
 struct sess;
@@ -70,7 +72,7 @@
 		HTTP_Obj
 	}			logtag;
 
-	struct http_hdr		hd[MAX_HTTP_HDRS];
+	struct http_hdr		hd[HTTP_HDR_MAX];
 	unsigned		nhd;
 };
 

Modified: trunk/varnish-cache/bin/varnishd/cache_http.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_http.c	2006-08-09 09:36:29 UTC (rev 776)
+++ trunk/varnish-cache/bin/varnishd/cache_http.c	2006-08-09 11:22:55 UTC (rev 777)
@@ -274,7 +274,7 @@
 		    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 @@
 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 @@
 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 @@
 
 	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 @@
 {
 
 	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 @@
 	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 {




More information about the varnish-commit mailing list