mirror of
git://jb55.com/damus
synced 2024-09-18 19:23:49 +00:00
damus-c: add cursor_skip helper
This is a cursor util for skipping over bytes
This commit is contained in:
parent
f976f23854
commit
972a183ed8
@ -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))
|
||||
|
Loading…
Reference in New Issue
Block a user