diff options
| author | William Casarin <jb55@jb55.com> | 2018-07-09 15:48:55 -0700 |
|---|---|---|
| committer | William Casarin <jb55@jb55.com> | 2018-07-09 15:49:33 -0700 |
| commit | 0206052b5660cb77cdd0a0ac3c83dd4c3d996007 (patch) | |
| tree | f0b0f1cd48f0f8f67d85e981be114e84d36ac8b3 /ccan/tal/str/test/helper.h | |
| parent | c999204365695799c9b7d79f4973d307421afecb (diff) | |
started on positioning + command structure
Diffstat (limited to 'ccan/tal/str/test/helper.h')
| -rw-r--r-- | ccan/tal/str/test/helper.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/ccan/tal/str/test/helper.h b/ccan/tal/str/test/helper.h new file mode 100644 index 0000000..5f0b68f --- /dev/null +++ b/ccan/tal/str/test/helper.h @@ -0,0 +1,22 @@ +/* tal/talloc can't implement tal_first/tal_next. */ +#ifdef TAL_USE_TALLOC +static inline bool no_children(const void *ctx) +{ + return talloc_total_blocks(ctx) == 1; +} + +static inline bool single_child(const void *ctx, const void *child) +{ + return talloc_total_blocks(ctx) == 2 && tal_parent(child) == ctx; +} +#else +static inline bool no_children(const void *ctx) +{ + return !tal_first(ctx); +} + +static inline bool single_child(const void *ctx, const void *child) +{ + return tal_first(ctx) == child && !tal_next(child) && !tal_first(child); +} +#endif |
