X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Frfc822%2Ftest%2Frun-default-alloc-failure.c;fp=ccan%2Frfc822%2Ftest%2Frun-default-alloc-failure.c;h=b81fd4c0c9644c4f89132d3713dbe54199740aa7;hp=c208154281106b18a2371dfcabd62bd49a21d384;hb=e4b6a262822484244b52c476d1b4cc9c4fd8ee2b;hpb=97d99004bec31012400b6c1d9bad045ae1c9b075 diff --git a/ccan/rfc822/test/run-default-alloc-failure.c b/ccan/rfc822/test/run-default-alloc-failure.c index c2081542..b81fd4c0 100644 --- a/ccan/rfc822/test/run-default-alloc-failure.c +++ b/ccan/rfc822/test/run-default-alloc-failure.c @@ -10,7 +10,11 @@ #include -#include +#ifdef TAL_USE_TALLOC +#include +#else +#include +#endif static bool should_fail = false; @@ -18,16 +22,16 @@ static void *mayfail_alloc(const void *ctx, size_t size) { if (should_fail) return NULL; - return talloc_zero_size(ctx, size); + return tal_arrz(ctx, char, size); } /* Override various tallocation functions. */ -#undef talloc -#undef talloc_zero -#undef talloc_array -#define talloc(ctx, type) mayfail_alloc((ctx), sizeof(type)) -#define talloc_zero(ctx, type) mayfail_alloc((ctx), sizeof(type)) -#define talloc_array(ctx, type, num) mayfail_alloc((ctx), sizeof(type)*(num)) +#undef tal +#undef talz +#undef tal_arr +#define tal(ctx, type) mayfail_alloc((ctx), sizeof(type)) +#define talz(ctx, type) mayfail_alloc((ctx), sizeof(type)) +#define tal_arr(ctx, type, num) mayfail_alloc((ctx), sizeof(type)*(num)) #include