r2738 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Fri Jun 20 12:15:57 CEST 2008


Author: phk
Date: 2008-06-20 12:15:56 +0200 (Fri, 20 Jun 2008)
New Revision: 2738

Modified:
   trunk/varnish-cache/bin/varnishd/cache.h
Log:
Add a hand function to safely add text to a txt



Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h	2008-06-20 07:32:38 UTC (rev 2737)
+++ trunk/varnish-cache/bin/varnishd/cache.h	2008-06-20 10:15:56 UTC (rev 2738)
@@ -38,6 +38,7 @@
 #include <pthread_np.h>
 #endif
 #include <stdint.h>
+#include <string.h>
 #include <limits.h>
 
 #include "vqueue.h"
@@ -687,6 +688,18 @@
 	    ((unsigned)(t.e - t.b));
 }
 
+static inline void
+Tadd(txt *t, const char *p, int l)
+{
+	if (l <= 0) {
+	} if (t->b + l < t->e) {
+		memcpy(t->b, p, l);
+		t->b += l;
+	} else {
+		t->b = t->e;
+	}
+}
+
 #ifdef WITHOUT_ASSERTS
 #define spassert(cond) ((void)(cond))
 #define SPAZ(val) ((void)(val) == 0)




More information about the varnish-commit mailing list