X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Frfc822%2Frfc822.c;fp=ccan%2Frfc822%2Frfc822.c;h=08c0541328396c10f0afa59486429602610b4c16;hb=e4b6a262822484244b52c476d1b4cc9c4fd8ee2b;hp=7f9442a8d04d235908abfd8c15e32520d97acd0f;hpb=97d99004bec31012400b6c1d9bad045ae1c9b075;p=ccan diff --git a/ccan/rfc822/rfc822.c b/ccan/rfc822/rfc822.c index 7f9442a8..08c05413 100644 --- a/ccan/rfc822/rfc822.c +++ b/ccan/rfc822/rfc822.c @@ -5,11 +5,17 @@ #include #include -#include #include +#include #include +#ifdef TAL_USE_TALLOC +#include +#else +#include +#endif + #if !HAVE_MEMMEM void *memmem(const void *haystack, size_t haystacklen, const void *needle, size_t needlelen) @@ -92,6 +98,8 @@ struct rfc822_msg *rfc822_check(const struct rfc822_msg *msg, assert(msg); if (!list_check(&msg->headers, abortstr)) return NULL; + if (!tal_check(msg, abortstr)) + return NULL; return (struct rfc822_msg *)msg; } @@ -106,7 +114,7 @@ struct rfc822_msg *rfc822_start(const void *ctx, const char *p, size_t len) struct rfc822_msg *msg; int i; - msg = talloc(ctx, struct rfc822_msg); + msg = tal(ctx, struct rfc822_msg); ALLOC_CHECK(msg, NULL); msg->data = p; @@ -128,7 +136,7 @@ struct rfc822_msg *rfc822_start(const void *ctx, const char *p, size_t len) void rfc822_free(struct rfc822_msg *msg) { CHECK(msg, ">rfc822_free"); - talloc_free(msg); + tal_free(msg); } static struct rfc822_header *next_header_cached(struct rfc822_msg *msg, @@ -200,7 +208,7 @@ static struct rfc822_header *next_header_parse(struct rfc822_msg *msg) msg->remainder = eh; - hi = talloc_zero(msg, struct rfc822_header); + hi = talz(msg, struct rfc822_header); ALLOC_CHECK(hi, NULL); hi->all = bytestring(h, eh - h); @@ -354,7 +362,7 @@ struct bytestring rfc822_header_unfolded_value(struct rfc822_msg *msg, if (lines <= 1) { hdr->unfolded = bytestring(raw.ptr, len); } else { - char *unfold = talloc_array(msg, char, len); + char *unfold = tal_arr(msg, char, len); char *p = unfold; ALLOC_CHECK(unfold, bytestring_NULL); @@ -447,7 +455,7 @@ static struct rfc822_header *index_header(struct rfc822_msg *msg, if (!hn) { unsigned hash = headerhash(hname); - hn = talloc_zero(msg, struct rfc822_headers_of_name); + hn = talz(msg, struct rfc822_headers_of_name); ALLOC_CHECK(hn, NULL); hn->name = hname;