added free_shared_memory method

master
Anton Lydike 5 years ago
parent 0ab4ae2be9
commit a070980af1

@ -49,6 +49,7 @@ int image_new_shared(int width, int height, Image* img);
void image_destroy_shared(Image img); void image_destroy_shared(Image img);
void* create_shared_memory(size_t size); void* create_shared_memory(size_t size);
void free_shared_memory(void* ptr, size_t size);
#include "src/images.c" #include "src/images.c"
#include "src/bmp-format.c" #include "src/bmp-format.c"

@ -41,3 +41,7 @@ void* create_shared_memory(size_t size) {
// but the manpage for `mmap` explains their purpose. // but the manpage for `mmap` explains their purpose.
return mmap(NULL, size, protection, visibility, -1, 0); return mmap(NULL, size, protection, visibility, -1, 0);
} }
void free_shared_memory(void* ptr, size_t size) {
munmap(ptr, size);
}
Loading…
Cancel
Save