| 42 | } |
| 43 | |
| 44 | void tal_wally_end(const tal_t *parent) |
| 45 | { |
| 46 | tal_t *p; |
| 47 | if (!wally_tal_ctx) { |
| 48 | /* This makes valgrind show us backtraces! */ |
| 49 | *(u8 *)wally_tal_ctx = '\0'; |
| 50 | abort(); |
| 51 | } |
| 52 | while ((p = tal_first(wally_tal_ctx)) != NULL) { |
| 53 | /* Refuse to make a loop! |
| 54 | * Did you mean to use tal_wally_end_onto? */ |
| 55 | assert(p != parent); |
| 56 | /* Don't steal backtrace from wally_tal_ctx! */ |
| 57 | if (tal_name(p) && streq(tal_name(p), "backtrace")) { |
| 58 | tal_free(p); |
| 59 | continue; |
| 60 | } |
| 61 | tal_steal(parent, p); |
| 62 | } |
| 63 | assert(tal_check(wally_tal_ctx, "tal_wally_end ctx check")); |
| 64 | wally_tal_ctx = tal_free(wally_tal_ctx); |
| 65 | } |
| 66 | |
| 67 | void tal_wally_end_onto_(const tal_t *parent, |
| 68 | tal_t *from_wally, |