Skip to content

Commit

Permalink
Revert "buffer: remove unused _drain method"
Browse files Browse the repository at this point in the history
This reverts commit b3f42f9.
  • Loading branch information
Gottox committed Aug 15, 2023
1 parent 1eee394 commit b685c70
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
13 changes: 13 additions & 0 deletions include/sqsh_primitive_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,19 @@ SQSH_NO_EXPORT SQSH_NO_UNUSED int sqsh__buffer_append(
SQSH_NO_EXPORT SQSH_NO_UNUSED int
sqsh__buffer_move(struct SqshBuffer *buffer, struct SqshBuffer *source);

/**
* @internal
* @memberof SqshBuffer
* @brief resets the buffer size to 0.
*
* This does not free the memory allocated by the buffer so that
* the buffer can be reused.
*
* @param[in,out] buffer The SqshBuffer to drain.
*/

void sqsh__buffer_drain(struct SqshBuffer *buffer);

/**
* @internal
* @memberof SqshBuffer
Expand Down
5 changes: 5 additions & 0 deletions lib/primitive/buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ sqsh__buffer_move(struct SqshBuffer *buffer, struct SqshBuffer *source) {
return 0;
}

void
sqsh__buffer_drain(struct SqshBuffer *buffer) {
buffer->size = 0;
}

const uint8_t *
sqsh__buffer_data(const struct SqshBuffer *buffer) {
return buffer->data;
Expand Down

0 comments on commit b685c70

Please sign in to comment.