Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit c0914ec

Browse files
committedOct 28, 2014
sys:ringbuffer: static inline ringbuffer_init
1 parent 6b4ac47 commit c0914ec

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed
 

‎sys/include/ringbuffer.h

+7-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,13 @@ typedef struct ringbuffer {
4545
* @param[in] buffer Buffer to use by rb.
4646
* @param[in] bufsize `sizeof (buffer)`
4747
*/
48-
void ringbuffer_init(ringbuffer_t *restrict rb, char *buffer, unsigned bufsize);
48+
static inline void ringbuffer_init(ringbuffer_t *restrict rb, char *buffer, unsigned bufsize)
49+
{
50+
rb->buf = buffer;
51+
rb->size = bufsize;
52+
rb->start = 0;
53+
rb->avail = 0;
54+
}
4955

5056
/**
5157
* @brief Add an element to the ringbuffer.

‎sys/lib/ringbuffer.c

-8
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,6 @@
1818

1919
#include "ringbuffer.h"
2020

21-
void ringbuffer_init(ringbuffer_t *restrict rb, char *buffer, unsigned bufsize)
22-
{
23-
rb->buf = buffer;
24-
rb->size = bufsize;
25-
rb->start = 0;
26-
rb->avail = 0;
27-
}
28-
2921
/**
3022
* @brief Add an element to the end of the ringbuffer.
3123
* @details This helper function does not check the pre-requirements for adding,

0 commit comments

Comments
 (0)
Please sign in to comment.