From ff5bd0b005b8a25822cb88263b893e476c873973 Mon Sep 17 00:00:00 2001 From: "L. Pereira" Date: Sun, 26 May 2024 10:19:14 -0700 Subject: [PATCH] Actually implement the try_put_copy() ringbuffer method --- src/lib/ringbuffer.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/lib/ringbuffer.h b/src/lib/ringbuffer.h index 045032f05..9741b54e8 100644 --- a/src/lib/ringbuffer.h +++ b/src/lib/ringbuffer.h @@ -83,6 +83,15 @@ rb->array[type_name_##_mask(rb->write++)] = e; \ } \ \ + __attribute__((unused)) static inline bool type_name_##_try_put_copy( \ + struct type_name_ *rb, element_type_ e) \ + { \ + if (type_name_##_full(rb)) \ + return false; \ + \ + rb->array[type_name_##_mask(rb->write++)] = e; \ + } \ + \ __attribute__((unused)) static inline bool type_name_##_try_put( \ struct type_name_ *rb, const element_type_ *e) \ { \