]> err.no Git - varnish/commitdiff
Add a hand function to safely add text to a txt
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Fri, 20 Jun 2008 10:15:56 +0000 (10:15 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Fri, 20 Jun 2008 10:15:56 +0000 (10:15 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2738 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/cache.h

index b138a1a45ea7f318cd9397abb63e41ab72cb2b5a..622f18d5a097315c1ecd205a63be51701009e65b 100644 (file)
@@ -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 @@ Tlen(const txt t)
            ((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)