Nicolas Dextraze 8d81a8a55a add fields to recorded_event_t
use size_t
2018-03-19 11:12:05 -07:00

28 lines
532 B
C

//
// Created by nicol on 2018-03-18.
//
#include <stdlib.h>
#include <string.h>
#include "buffer.h"
const buffer_t buffer_create(size_t size) {
buffer_t buf = {size, malloc(size)};
return buf;
}
const buffer_t buffer_from(uint8_t* data, size_t size) {
buffer_t buf = {size, data};
return buf;
}
const buffer_t buffer_copyfrom(uint8_t* data, size_t size) {
buffer_t buf = {size, malloc(size)};
memcpy(buf.data, data, size);
return buf;
}
void buffer_free(buffer_t buffer) {
free(buffer.data);
}