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:
committed by
Daniel D’Aquino
parent
aa5809d792
commit
371e9fb406
@@ -85,6 +85,16 @@ static inline int cursor_slice(struct cursor *mem, struct cursor *slice, size_t
|
|||||||
return 1;
|
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)
|
static inline void copy_cursor(struct cursor *src, struct cursor *dest)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user