|
|
@@ -29,7 +29,7 @@ extern "C" {
|
|
|
|
|
|
/* Dynamic circular buffer */
|
|
|
|
|
|
-struct circlebuf {
|
|
|
+OBS_DEPRECATED struct circlebuf {
|
|
|
void *data;
|
|
|
size_t size;
|
|
|
|
|
|
@@ -38,19 +38,19 @@ struct circlebuf {
|
|
|
size_t capacity;
|
|
|
};
|
|
|
|
|
|
-static inline void circlebuf_init(struct circlebuf *cb)
|
|
|
+OBS_DEPRECATED static inline void circlebuf_init(struct circlebuf *cb)
|
|
|
{
|
|
|
memset(cb, 0, sizeof(struct circlebuf));
|
|
|
}
|
|
|
|
|
|
-static inline void circlebuf_free(struct circlebuf *cb)
|
|
|
+OBS_DEPRECATED static inline void circlebuf_free(struct circlebuf *cb)
|
|
|
{
|
|
|
bfree(cb->data);
|
|
|
memset(cb, 0, sizeof(struct circlebuf));
|
|
|
}
|
|
|
|
|
|
-static inline void circlebuf_reorder_data(struct circlebuf *cb,
|
|
|
- size_t new_capacity)
|
|
|
+OBS_DEPRECATED static inline void circlebuf_reorder_data(struct circlebuf *cb,
|
|
|
+ size_t new_capacity)
|
|
|
{
|
|
|
size_t difference;
|
|
|
uint8_t *data;
|
|
|
@@ -64,7 +64,8 @@ static inline void circlebuf_reorder_data(struct circlebuf *cb,
|
|
|
cb->start_pos += difference;
|
|
|
}
|
|
|
|
|
|
-static inline void circlebuf_ensure_capacity(struct circlebuf *cb)
|
|
|
+OBS_DEPRECATED static inline void
|
|
|
+circlebuf_ensure_capacity(struct circlebuf *cb)
|
|
|
{
|
|
|
size_t new_capacity;
|
|
|
if (cb->size <= cb->capacity)
|
|
|
@@ -79,7 +80,8 @@ static inline void circlebuf_ensure_capacity(struct circlebuf *cb)
|
|
|
cb->capacity = new_capacity;
|
|
|
}
|
|
|
|
|
|
-static inline void circlebuf_reserve(struct circlebuf *cb, size_t capacity)
|
|
|
+OBS_DEPRECATED static inline void circlebuf_reserve(struct circlebuf *cb,
|
|
|
+ size_t capacity)
|
|
|
{
|
|
|
if (capacity <= cb->capacity)
|
|
|
return;
|
|
|
@@ -89,7 +91,8 @@ static inline void circlebuf_reserve(struct circlebuf *cb, size_t capacity)
|
|
|
cb->capacity = capacity;
|
|
|
}
|
|
|
|
|
|
-static inline void circlebuf_upsize(struct circlebuf *cb, size_t size)
|
|
|
+OBS_DEPRECATED static inline void circlebuf_upsize(struct circlebuf *cb,
|
|
|
+ size_t size)
|
|
|
{
|
|
|
size_t add_size = size - cb->size;
|
|
|
size_t new_end_pos = cb->end_pos + add_size;
|
|
|
@@ -117,8 +120,9 @@ static inline void circlebuf_upsize(struct circlebuf *cb, size_t size)
|
|
|
}
|
|
|
|
|
|
/** Overwrites data at a specific point in the buffer (relative). */
|
|
|
-static inline void circlebuf_place(struct circlebuf *cb, size_t position,
|
|
|
- const void *data, size_t size)
|
|
|
+OBS_DEPRECATED static inline void circlebuf_place(struct circlebuf *cb,
|
|
|
+ size_t position,
|
|
|
+ const void *data, size_t size)
|
|
|
{
|
|
|
size_t end_point = position + size;
|
|
|
size_t data_end_pos;
|
|
|
@@ -142,8 +146,8 @@ static inline void circlebuf_place(struct circlebuf *cb, size_t position,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-static inline void circlebuf_push_back(struct circlebuf *cb, const void *data,
|
|
|
- size_t size)
|
|
|
+OBS_DEPRECATED static inline void
|
|
|
+circlebuf_push_back(struct circlebuf *cb, const void *data, size_t size)
|
|
|
{
|
|
|
size_t new_end_pos = cb->end_pos + size;
|
|
|
|
|
|
@@ -167,8 +171,8 @@ static inline void circlebuf_push_back(struct circlebuf *cb, const void *data,
|
|
|
cb->end_pos = new_end_pos;
|
|
|
}
|
|
|
|
|
|
-static inline void circlebuf_push_front(struct circlebuf *cb, const void *data,
|
|
|
- size_t size)
|
|
|
+OBS_DEPRECATED static inline void
|
|
|
+circlebuf_push_front(struct circlebuf *cb, const void *data, size_t size)
|
|
|
{
|
|
|
cb->size += size;
|
|
|
circlebuf_ensure_capacity(cb);
|
|
|
@@ -193,7 +197,8 @@ static inline void circlebuf_push_front(struct circlebuf *cb, const void *data,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-static inline void circlebuf_push_back_zero(struct circlebuf *cb, size_t size)
|
|
|
+OBS_DEPRECATED static inline void circlebuf_push_back_zero(struct circlebuf *cb,
|
|
|
+ size_t size)
|
|
|
{
|
|
|
size_t new_end_pos = cb->end_pos + size;
|
|
|
|
|
|
@@ -216,7 +221,8 @@ static inline void circlebuf_push_back_zero(struct circlebuf *cb, size_t size)
|
|
|
cb->end_pos = new_end_pos;
|
|
|
}
|
|
|
|
|
|
-static inline void circlebuf_push_front_zero(struct circlebuf *cb, size_t size)
|
|
|
+OBS_DEPRECATED static inline void
|
|
|
+circlebuf_push_front_zero(struct circlebuf *cb, size_t size)
|
|
|
{
|
|
|
cb->size += size;
|
|
|
circlebuf_ensure_capacity(cb);
|
|
|
@@ -240,8 +246,8 @@ static inline void circlebuf_push_front_zero(struct circlebuf *cb, size_t size)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-static inline void circlebuf_peek_front(struct circlebuf *cb, void *data,
|
|
|
- size_t size)
|
|
|
+OBS_DEPRECATED static inline void circlebuf_peek_front(struct circlebuf *cb,
|
|
|
+ void *data, size_t size)
|
|
|
{
|
|
|
assert(size <= cb->size);
|
|
|
|
|
|
@@ -259,8 +265,8 @@ static inline void circlebuf_peek_front(struct circlebuf *cb, void *data,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-static inline void circlebuf_peek_back(struct circlebuf *cb, void *data,
|
|
|
- size_t size)
|
|
|
+OBS_DEPRECATED static inline void circlebuf_peek_back(struct circlebuf *cb,
|
|
|
+ void *data, size_t size)
|
|
|
{
|
|
|
assert(size <= cb->size);
|
|
|
|
|
|
@@ -282,8 +288,8 @@ static inline void circlebuf_peek_back(struct circlebuf *cb, void *data,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-static inline void circlebuf_pop_front(struct circlebuf *cb, void *data,
|
|
|
- size_t size)
|
|
|
+OBS_DEPRECATED static inline void circlebuf_pop_front(struct circlebuf *cb,
|
|
|
+ void *data, size_t size)
|
|
|
{
|
|
|
circlebuf_peek_front(cb, data, size);
|
|
|
|
|
|
@@ -298,8 +304,8 @@ static inline void circlebuf_pop_front(struct circlebuf *cb, void *data,
|
|
|
cb->start_pos -= cb->capacity;
|
|
|
}
|
|
|
|
|
|
-static inline void circlebuf_pop_back(struct circlebuf *cb, void *data,
|
|
|
- size_t size)
|
|
|
+OBS_DEPRECATED static inline void circlebuf_pop_back(struct circlebuf *cb,
|
|
|
+ void *data, size_t size)
|
|
|
{
|
|
|
circlebuf_peek_back(cb, data, size);
|
|
|
|
|
|
@@ -315,7 +321,8 @@ static inline void circlebuf_pop_back(struct circlebuf *cb, void *data,
|
|
|
cb->end_pos -= size;
|
|
|
}
|
|
|
|
|
|
-static inline void *circlebuf_data(struct circlebuf *cb, size_t idx)
|
|
|
+OBS_DEPRECATED static inline void *circlebuf_data(struct circlebuf *cb,
|
|
|
+ size_t idx)
|
|
|
{
|
|
|
uint8_t *ptr = (uint8_t *)cb->data;
|
|
|
size_t offset = cb->start_pos + idx;
|