Commit 96505c6d authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Add a hand function to safely add text to a txt



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@2738 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 756120bc
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment