Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core/cib: add const to cib_peek() #21130

Merged
merged 1 commit into from
Jan 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions core/lib/include/cib.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ static inline int cib_get(cib_t *__restrict cib)
* @return index of item
* @retval -1 if no item at @p offset exists in the buffer
*/
static inline int cib_peek_at_unsafe(cib_t *__restrict cib, unsigned offset)
static inline int cib_peek_at_unsafe(const cib_t *__restrict cib, unsigned offset)
{
return (cib->read_count + offset) & cib->mask;
}
Expand All @@ -153,7 +153,7 @@ static inline int cib_peek_at_unsafe(cib_t *__restrict cib, unsigned offset)
* @return index of item
* @retval -1 if no item at @p offset exists in the buffer
*/
static inline int cib_peek_at(cib_t *__restrict cib, unsigned offset)
static inline int cib_peek_at(const cib_t *__restrict cib, unsigned offset)
{
if (offset < cib_avail(cib)) {
return cib_peek_at_unsafe(cib, offset);
Expand All @@ -172,7 +172,7 @@ static inline int cib_peek_at(cib_t *__restrict cib, unsigned offset)
* @return index of next item
* @retval -1 if the buffer is empty
*/
static inline int cib_peek_unsafe(cib_t *__restrict cib)
static inline int cib_peek_unsafe(const cib_t *__restrict cib)
{
return cib_peek_at_unsafe(cib, 0);
}
Expand All @@ -185,7 +185,7 @@ static inline int cib_peek_unsafe(cib_t *__restrict cib)
* @return index of next item
* @retval -1 if the buffer is empty
*/
static inline int cib_peek(cib_t *__restrict cib)
static inline int cib_peek(const cib_t *__restrict cib)
{
return cib_peek_at(cib, 0);
}
Expand Down
Loading