
8 changed files with 33 additions and 31 deletions
@ -1,16 +0,0 @@ |
|||||
#include "mark.h" |
|
||||
|
|
||||
void mbuf_reusable_init(Mbuf_reusable* mbr) { |
|
||||
mbr->buffer = NULL; |
|
||||
mbr->capacity = 0; |
|
||||
} |
|
||||
|
|
||||
void mbuf_reusable_ensure_size(Mbuf_reusable* mbr, Usz height, Usz width) { |
|
||||
Usz capacity = height * width; |
|
||||
if (mbr->capacity < capacity) { |
|
||||
mbr->buffer = realloc(mbr->buffer, capacity); |
|
||||
mbr->capacity = capacity; |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
void mbuf_reusable_deinit(Mbuf_reusable* mbr) { free(mbr->buffer); } |
|
@ -1,11 +0,0 @@ |
|||||
#pragma once |
|
||||
#include "base.h" |
|
||||
|
|
||||
typedef struct Mbuf_reusable { |
|
||||
Mark* buffer; |
|
||||
Usz capacity; |
|
||||
} Mbuf_reusable; |
|
||||
|
|
||||
void mbuf_reusable_init(Mbuf_reusable* mbr); |
|
||||
void mbuf_reusable_ensure_size(Mbuf_reusable* mbr, Usz height, Usz width); |
|
||||
void mbuf_reusable_deinit(Mbuf_reusable* mbr); |
|
Loading…
Reference in new issue