]> git.ozlabs.org Git - ccan/blobdiff - ccan/rfc822/test/run-default-alloc-failure.c
rfc822: switch to ccan/tal.
[ccan] / ccan / rfc822 / test / run-default-alloc-failure.c
index c208154281106b18a2371dfcabd62bd49a21d384..b81fd4c0c9644c4f89132d3713dbe54199740aa7 100644 (file)
 
 #include <ccan/rfc822/rfc822.h>
 
-#include <ccan/talloc/talloc.h>
+#ifdef TAL_USE_TALLOC
+#include <ccan/tal/talloc/talloc.h>
+#else
+#include <ccan/tal/tal.h>
+#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 <ccan/rfc822/rfc822.c>