21 lines
361 B
C
21 lines
361 B
C
|
//
|
||
|
// Created by nicol on 2018-03-18.
|
||
|
//
|
||
|
|
||
|
#include <stdlib.h>
|
||
|
#include "buffer.h"
|
||
|
|
||
|
const buffer_t buffer_create(uint32_t size) {
|
||
|
buffer_t buf = {size, malloc(size)};
|
||
|
return buf;
|
||
|
}
|
||
|
|
||
|
const buffer_t buffer_from(uint8_t* data, uint32_t size) {
|
||
|
buffer_t buf = {size, data};
|
||
|
return buf;
|
||
|
}
|
||
|
|
||
|
void buffer_free(buffer_t buffer) {
|
||
|
free(buffer.data);
|
||
|
}
|