commit 27905d24b4a91b015c8fd6d39057d61dd9264e78
parent 7a5aef94a8cf854185ffceda15306571f791b4da
Author: William Casarin <jb55@jb55.com>
Date: Sat, 2 Dec 2023 13:41:19 -0800
cursor: add cursor_memset
Diffstat:
1 file changed, 13 insertions(+), 0 deletions(-)
diff --git a/damus-c/cursor.h b/damus-c/cursor.h
@@ -673,4 +673,17 @@ static inline int consume_until_non_alphanumeric(struct cursor *cur, int or_end)
return or_end;
}
+
+static inline int cursor_memset(struct cursor *cursor, unsigned char c, int n)
+{
+ if (cursor->p + n >= cursor->end)
+ return 0;
+
+ memset(cursor->p, c, n);
+ cursor->p += n;
+
+ return 1;
+}
+
+
#endif