mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-22 19:22:50 -06:00
fix two warnings in mem.c
This commit is contained in:
@@ -230,7 +230,8 @@ gu_mmap_pool(char* fpath, void* addr, size_t size, void**pptr)
|
|||||||
uint8_t* buf = gu_mem_buf_alloc(sz, &sz);
|
uint8_t* buf = gu_mem_buf_alloc(sz, &sz);
|
||||||
GuPool* pool = gu_init_pool(buf, size);
|
GuPool* pool = gu_init_pool(buf, size);
|
||||||
|
|
||||||
*((int*) pool->init_buf) = fd;
|
uint8_t* pfd = pool->init_buf;
|
||||||
|
*((int*) pfd) = fd;
|
||||||
|
|
||||||
pool->type = GU_POOL_MMAP;
|
pool->type = GU_POOL_MMAP;
|
||||||
pool->curr_buf = ptr;
|
pool->curr_buf = ptr;
|
||||||
@@ -376,7 +377,8 @@ gu_pool_free(GuPool* pool)
|
|||||||
if (pool->type == GU_POOL_HEAP) {
|
if (pool->type == GU_POOL_HEAP) {
|
||||||
gu_mem_buf_free(pool);
|
gu_mem_buf_free(pool);
|
||||||
} else if (pool->type == GU_POOL_MMAP) {
|
} else if (pool->type == GU_POOL_MMAP) {
|
||||||
int fd = *((int*) pool->init_buf);
|
uint8_t* pfd = pool->init_buf;
|
||||||
|
int fd = *(pfd);
|
||||||
|
|
||||||
munmap(pool->curr_buf, pool->curr_size);
|
munmap(pool->curr_buf, pool->curr_size);
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|||||||
Reference in New Issue
Block a user