procgroup capabilities
All checks were successful
Build documentation / build-and-deploy (push) Successful in 1m55s
All checks were successful
Build documentation / build-and-deploy (push) Successful in 1m55s
This commit is contained in:
20
kernel/libk/ringbuffer.c
Normal file
20
kernel/libk/ringbuffer.c
Normal file
@@ -0,0 +1,20 @@
|
||||
#include <libk/ringbuffer.h>
|
||||
#include <libk/std.h>
|
||||
#include <libk/string.h>
|
||||
#include <mm/liballoc.h>
|
||||
|
||||
bool ringbuffer_init (struct ringbuffer* rb, size_t capacity, size_t type_size) {
|
||||
void* buf = malloc (capacity * type_size);
|
||||
|
||||
if (buf == NULL)
|
||||
return false;
|
||||
|
||||
memset (rb, 0, sizeof (*rb));
|
||||
|
||||
rb->capacity = capacity;
|
||||
rb->buffer = buf;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ringbuffer_fini (struct ringbuffer* rb) { free (rb->buffer); }
|
||||
Reference in New Issue
Block a user