diff options
| author | Mitja Felicijan <mitja.felicijan@gmail.com> | 2023-11-09 23:19:53 +0100 |
|---|---|---|
| committer | Mitja Felicijan <mitja.felicijan@gmail.com> | 2023-11-09 23:19:53 +0100 |
| commit | 1566b6faa8534118c3566188181367cd0868468f (patch) | |
| tree | 1de8d4b369efb5e592685a31088f798a6b63ffa1 /examples/dte/block.c | |
| parent | 349991bf6efe473ab9a5cbdae0a8114d72b997e3 (diff) | |
| download | crep-1566b6faa8534118c3566188181367cd0868468f.tar.gz | |
Added partial matching and introduced threads
Diffstat (limited to 'examples/dte/block.c')
| -rw-r--r-- | examples/dte/block.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/examples/dte/block.c b/examples/dte/block.c new file mode 100644 index 0000000..3953571 --- /dev/null +++ b/examples/dte/block.c @@ -0,0 +1,19 @@ +#include <stdlib.h> +#include "block.h" +#include "util/xmalloc.h" + +Block *block_new(size_t alloc) +{ + Block *blk = xnew0(Block, 1); + alloc = round_size_to_next_multiple(alloc, BLOCK_ALLOC_MULTIPLE); + blk->data = xmalloc(alloc); + blk->alloc = alloc; + return blk; +} + +void block_free(Block *blk) +{ + list_del(&blk->node); + free(blk->data); + free(blk); +} |
