1
0
mirror of git://jb55.com/damus synced 2024-09-16 02:03:45 +00:00

damus-c: add cursor_skip helper

This is a cursor util for skipping over bytes
This commit is contained in:
William Casarin 2023-11-17 08:07:43 -08:00
parent f976f23854
commit 972a183ed8

View File

@ -96,6 +96,16 @@ static inline void copy_cursor(struct cursor *src, struct cursor *dest)
dest->end = src->end;
}
static inline int cursor_skip(struct cursor *cursor, int n)
{
if (cursor->p + n >= cursor->end)
return 0;
cursor->p += n;
return 1;
}
static inline int pull_byte(struct cursor *cursor, u8 *c)
{
if (unlikely(cursor->p >= cursor->end))