damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit 972a183ed876643c822e5867c7d9c1d6eac0e775
parent f976f23854dfddc390bf00095c69d27460c6776d
Author: William Casarin <jb55@jb55.com>
Date:   Fri, 17 Nov 2023 08:07:43 -0800

damus-c: add cursor_skip helper

This is a cursor util for skipping over bytes

Diffstat:
Mdamus-c/cursor.h | 10++++++++++
1 file changed, 10 insertions(+), 0 deletions(-)

diff --git a/damus-c/cursor.h b/damus-c/cursor.h @@ -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))