nostrdb/cursor: add malloc_slice

This is the same as cursor_slice except we don't memset afterwards

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2023-12-27 12:40:26 -08:00
committed by Daniel D’Aquino
parent aa5809d792
commit 371e9fb406

View File

@@ -85,6 +85,16 @@ static inline int cursor_slice(struct cursor *mem, struct cursor *slice, size_t
return 1;
}
static inline int cursor_malloc_slice(struct cursor *mem, struct cursor *slice, size_t size)
{
unsigned char *p;
if (!(p = cursor_malloc(mem, size))) {
return 0;
}
make_cursor(p, mem->p, slice);
return 1;
}
static inline void copy_cursor(struct cursor *src, struct cursor *dest)
{