mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-24 01:24:26 +01:00
common/utils.h: add tal_arr_expand helper.
We do this a lot, and had boutique helpers in various places. So add a more generic one; for convenience it returns a pointer to the new end element. I prefer the name tal_arr_expand to tal_arr_append, since it's up to the caller to populate the new array entry. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Christian Decker
parent
d590302523
commit
96f05549b2
@@ -23,10 +23,7 @@ static bool param_add(struct param **params,
|
||||
if (!(name && cbx && arg))
|
||||
return false;
|
||||
#endif
|
||||
struct param *last;
|
||||
|
||||
tal_resize(params, tal_count(*params) + 1);
|
||||
last = &(*params)[tal_count(*params) - 1];
|
||||
struct param *last = tal_arr_expand(params);
|
||||
|
||||
last->is_set = false;
|
||||
last->name = name;
|
||||
|
||||
Reference in New Issue
Block a user