libghostty
Loading...
Searching...
No Matches
allocator.h
Go to the documentation of this file.
1
6
7#ifndef GHOSTTY_VT_ALLOCATOR_H
8#define GHOSTTY_VT_ALLOCATOR_H
9
10#include <stdbool.h>
11#include <stddef.h>
12#include <stdint.h>
13#include <ghostty/vt/types.h>
14
71
106typedef struct {
118 void* (*alloc)(void *ctx, size_t len, uint8_t alignment, uintptr_t ret_addr);
119
138 bool (*resize)(void *ctx, void *memory, size_t memory_len, uint8_t alignment, size_t new_len, uintptr_t ret_addr);
139
165 void* (*remap)(void *ctx, void *memory, size_t memory_len, uint8_t alignment, size_t new_len, uintptr_t ret_addr);
166
181 void (*free)(void *ctx, void *memory, size_t memory_len, uint8_t alignment, uintptr_t ret_addr);
183
203typedef struct GhosttyAllocator {
209 void *ctx;
210
217
231GHOSTTY_API uint8_t* ghostty_alloc(const GhosttyAllocator* allocator, size_t len);
232
256GHOSTTY_API void ghostty_free(const GhosttyAllocator* allocator, uint8_t* ptr, size_t len);
257
259
260#endif /* GHOSTTY_VT_ALLOCATOR_H */
GHOSTTY_API uint8_t * ghostty_alloc(const GhosttyAllocator *allocator, size_t len)
GHOSTTY_API void ghostty_free(const GhosttyAllocator *allocator, uint8_t *ptr, size_t len)
void(*) free(void *ctx, void *memory, size_t memory_len, uint8_t alignment, uintptr_t ret_addr)
Definition allocator.h:181
bool(*) resize(void *ctx, void *memory, size_t memory_len, uint8_t alignment, size_t new_len, uintptr_t ret_addr)
Definition allocator.h:138
const GhosttyAllocatorVtable * vtable
Definition allocator.h:215