Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static dynmem_t dm_new()
- {
- return (dynmem_t) {
- NULL, 0, 0, 0
- };
- }
- static void dm_write(dynmem_t * dm, void *ptr, int size)
- {
- if(dm->cursor + size > dm->size)
- {
- dm->size += 0x100;
- void *nx = realloc(dm->ptr, dm->size);
- if(nx == NULL)
- ; // TODO: Handle error
- dm->ptr = nx;
- }
- mem_copy(&dm->ptr[dm->cursor], ptr, size);
- dm->cursor += size;
- }
Advertisement
Add Comment
Please, Sign In to add comment