# Re: \[PATCH 5/5\] cbtree.h: define cb\_init() in terms of CBTREE\_INIT

- From: Johannes Sixt \<hidden\>
- Date: 2021-09-27 06:37:56 
- List: git
- Page: https://ratatoskr.run/git/2021/09/7903680
- Thread: https://ratatoskr.run/git/2021/09/7903662/t.md

```text
Am 27.09.21 um 02:39 schrieb Ævar Arnfjörð Bjarmason:
> --- a/cbtree.h
> +++ b/cbtree.h
> @@ -37,11 +37,12 @@ enum cb_next {
>  	CB_BREAK = 1
>  };
>  
> -#define CBTREE_INIT { .root = NULL }
> +#define CBTREE_INIT { 0 }
>  
>  static inline void cb_init(struct cb_tree *t)
>  {
> -	t->root = NULL;
> +	struct cb_tree blank = CBTREE_INIT;

This could be

	static const struct cb_tree blank = CBTREE_INIT;

> +	memcpy(t, &blank, sizeof(*t));

Is
	*t = blank;

not a thing in C?

-- Hannes
```
