Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
a85af593
Commit
a85af593
authored
Nov 27, 2011
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fifo_buffer: add functions _capacity() and _available()
parent
07067f8b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
0 deletions
+29
-0
fifo_buffer.c
src/fifo_buffer.c
+16
-0
fifo_buffer.h
src/fifo_buffer.h
+13
-0
No files found.
src/fifo_buffer.c
View file @
a85af593
...
...
@@ -66,6 +66,22 @@ fifo_buffer_free(struct fifo_buffer *buffer)
g_free
(
buffer
);
}
size_t
fifo_buffer_capacity
(
const
struct
fifo_buffer
*
buffer
)
{
assert
(
buffer
!=
NULL
);
return
buffer
->
size
;
}
size_t
fifo_buffer_available
(
const
struct
fifo_buffer
*
buffer
)
{
assert
(
buffer
!=
NULL
);
return
buffer
->
end
-
buffer
->
start
;
}
void
fifo_buffer_clear
(
struct
fifo_buffer
*
buffer
)
{
...
...
src/fifo_buffer.h
View file @
a85af593
...
...
@@ -63,6 +63,19 @@ void
fifo_buffer_free
(
struct
fifo_buffer
*
buffer
);
/**
* Return the capacity of the buffer, i.e. the size that was passed to
* fifo_buffer_new().
*/
size_t
fifo_buffer_capacity
(
const
struct
fifo_buffer
*
buffer
);
/**
* Return the number of bytes currently stored in the buffer.
*/
size_t
fifo_buffer_available
(
const
struct
fifo_buffer
*
buffer
);
/**
* Clears all data currently in this #fifo_buffer object. This does
* not overwrite the actuall buffer; it just resets the internal
* pointers.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment