From 85cd034cdf722e404ea9102f4831a30d701057e7 Mon Sep 17 00:00:00 2001 From: phk Date: Fri, 20 Jun 2008 10:15:56 +0000 Subject: [PATCH] Add a hand function to safely add text to a txt git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2738 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/varnish-cache/bin/varnishd/cache.h b/varnish-cache/bin/varnishd/cache.h index b138a1a4..622f18d5 100644 --- a/varnish-cache/bin/varnishd/cache.h +++ b/varnish-cache/bin/varnishd/cache.h @@ -38,6 +38,7 @@ #include #endif #include +#include #include #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) -- 2.39.5