mirror of
https://github.com/aljazceru/lightning.git
synced 2026-02-23 15:04:19 +01:00
common: tal_dup_talarr() helper.
This is a common thing to do, so create a macro. Unfortunately, it still needs the type arg, because the paramter may be const, and the return cannot be, and C doesn't have a general "(-const)" cast. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
@@ -141,3 +141,10 @@ void tal_arr_remove_(void *p, size_t elemsize, size_t n)
|
||||
len - (elemsize * (n+1)));
|
||||
tal_resize((char **)p, len - elemsize);
|
||||
}
|
||||
|
||||
void *tal_dup_talarr_(const tal_t *ctx, const tal_t *src, const char *label)
|
||||
{
|
||||
if (!src)
|
||||
return NULL;
|
||||
return tal_dup_(ctx, src, 1, tal_bytelen(src), 0, label);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user