Skip to content

Commit ce9a727

Browse files
author
Kristian Kinderlöv
committedDec 29, 2021
Update doxygen tags
1 parent 18cc990 commit ce9a727

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed
 

‎.clang-format

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Run manually to reformat a file:
22
# clang-format -i --style=file <file>
3+
---
34
Language: Cpp
45
BasedOnStyle: Google
5-
IndentWidth: 4
66
UseTab: Never
7+
IndentWidth: 4
8+
ColumnLimit: 100
9+
...

‎circularbuffer.c

+6-8
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,13 @@
3636
/* **** Includes **** */
3737

3838
#include "circularbuffer.h"
39-
#include <string.h>
39+
4040
#include <assert.h>
41+
#include <string.h>
4142

4243
/* **** Defines **** */
4344

44-
#define ASSERT(expr) assert(expr)
45+
#define ASSERT(expr) assert(expr)
4546

4647
/* **** Function Definitions **** */
4748

@@ -81,8 +82,7 @@ int32_t CircularBufferPushBack(CircularBufferContext *ctx, const void *val) {
8182
goto fail;
8283
}
8384

84-
memcpy(&ctx->buf[ctx->write_pos * ctx->element_size], val,
85-
ctx->element_size);
85+
memcpy(&ctx->buf[ctx->write_pos * ctx->element_size], val, ctx->element_size);
8686
ctx->write_pos = write_pos;
8787

8888
return 0;
@@ -100,8 +100,7 @@ int32_t CircularBufferPopFront(CircularBufferContext *ctx, void *val) {
100100
goto fail;
101101
}
102102

103-
memcpy(val, &ctx->buf[ctx->read_pos * ctx->element_size],
104-
ctx->element_size);
103+
memcpy(val, &ctx->buf[ctx->read_pos * ctx->element_size], ctx->element_size);
105104

106105
ctx->read_pos = (ctx->read_pos + 1) & ctx->max_size;
107106

@@ -111,8 +110,7 @@ int32_t CircularBufferPopFront(CircularBufferContext *ctx, void *val) {
111110
return -1;
112111
}
113112

114-
int32_t CircularBufferPeek(const CircularBufferContext *ctx, size_t num,
115-
void **elem) {
113+
int32_t CircularBufferPeek(const CircularBufferContext *ctx, size_t num, void **elem) {
116114
ASSERT(ctx);
117115

118116
const size_t write_pos = ctx->write_pos;

‎circularbuffer.h

+9-10
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ typedef struct {
6464
/* **** Function Declarations **** */
6565

6666
/**
67-
* @breif Initializes the circular buffer context.
67+
* @brief Initializes the circular buffer context.
6868
*
6969
* The max number of elements in the circular buffer is
7070
* (buf_size / element_size) - 1.
@@ -85,7 +85,7 @@ void CircularBufferInit(CircularBufferContext *ctx, void *buf, size_t buf_size,
8585
size_t element_size);
8686

8787
/**
88-
* @breif Removes all elements from the circular buffer.
88+
* @brief Removes all elements from the circular buffer.
8989
*
9090
* Asserts if:
9191
* 'ctx' is NULL.
@@ -95,7 +95,7 @@ void CircularBufferInit(CircularBufferContext *ctx, void *buf, size_t buf_size,
9595
void CircularBufferClear(CircularBufferContext *ctx);
9696

9797
/**
98-
* @breif Adds an new element to the end of the buffer. The "val" content is
98+
* @brief Adds an new element to the end of the buffer. The "val" content is
9999
* copied to the element.
100100
*
101101
* Asserts if:
@@ -109,7 +109,7 @@ void CircularBufferClear(CircularBufferContext *ctx);
109109
int32_t CircularBufferPushBack(CircularBufferContext *ctx, const void *val);
110110

111111
/**
112-
* @breif Removes the first element from the buffer. Copies the element content
112+
* @brief Removes the first element from the buffer. Copies the element content
113113
* to the "val" destination.
114114
*
115115
* Asserts if:
@@ -125,7 +125,7 @@ int32_t CircularBufferPushBack(CircularBufferContext *ctx, const void *val);
125125
int32_t CircularBufferPopFront(CircularBufferContext *ctx, void *val);
126126

127127
/**
128-
* @breif Peeks the "num" element from the buffer.
128+
* @brief Peeks the "num" element from the buffer.
129129
*
130130
* The "num" argument shall be less than the number of elements added to the
131131
* buffer.
@@ -139,11 +139,10 @@ int32_t CircularBufferPopFront(CircularBufferContext *ctx, void *val);
139139
* @return 0 if success, -1 or NULL buffer is empty or the
140140
* 'num' is out of bounds.
141141
*/
142-
int32_t CircularBufferPeek(const CircularBufferContext *ctx, size_t num,
143-
void **elem);
142+
int32_t CircularBufferPeek(const CircularBufferContext *ctx, size_t num, void **elem);
144143

145144
/**
146-
* @breif Gets the number of added elements in the buffer.
145+
* @brief Gets the number of added elements in the buffer.
147146
*
148147
* Asserts if:
149148
* 'ctx' is NULL.
@@ -154,7 +153,7 @@ int32_t CircularBufferPeek(const CircularBufferContext *ctx, size_t num,
154153
size_t CircularBufferSize(const CircularBufferContext *ctx);
155154

156155
/**
157-
* @breif Gets the number of free elements in the buffer.
156+
* @brief Gets the number of free elements in the buffer.
158157
*
159158
* Asserts if:
160159
* 'ctx' is NULL.
@@ -165,7 +164,7 @@ size_t CircularBufferSize(const CircularBufferContext *ctx);
165164
size_t CircularBufferSpace(const CircularBufferContext *ctx);
166165

167166
/**
168-
* @breif Checks if the buffer is empty.
167+
* @brief Checks if the buffer is empty.
169168
*
170169
* Asserts if:
171170
* 'ctx' is NULL.

0 commit comments

Comments
 (0)