diff options
Diffstat (limited to 'pcre/sljit/sljitUtils.c')
-rw-r--r-- | pcre/sljit/sljitUtils.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/pcre/sljit/sljitUtils.c b/pcre/sljit/sljitUtils.c index b29b4036b30..5294b5f3f9b 100644 --- a/pcre/sljit/sljitUtils.c +++ b/pcre/sljit/sljitUtils.c @@ -200,7 +200,7 @@ static SLJIT_INLINE sljit_si open_dev_zero(void) /* Planning to make it even more clever in the future. */ static sljit_sw sljit_page_align = 0; -SLJIT_API_FUNC_ATTRIBUTE struct sljit_stack* SLJIT_CALL sljit_allocate_stack(sljit_uw limit, sljit_uw max_limit) +SLJIT_API_FUNC_ATTRIBUTE struct sljit_stack* SLJIT_CALL sljit_allocate_stack(sljit_uw limit, sljit_uw max_limit, void *allocator_data) { struct sljit_stack *stack; union { @@ -211,6 +211,7 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_stack* SLJIT_CALL sljit_allocate_stack(slj SYSTEM_INFO si; #endif + SLJIT_UNUSED_ARG(allocator_data); if (limit > max_limit || limit < 1) return NULL; @@ -232,21 +233,21 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_stack* SLJIT_CALL sljit_allocate_stack(slj /* Align limit and max_limit. */ max_limit = (max_limit + sljit_page_align) & ~sljit_page_align; - stack = (struct sljit_stack*)SLJIT_MALLOC(sizeof(struct sljit_stack)); + stack = (struct sljit_stack*)SLJIT_MALLOC(sizeof(struct sljit_stack), allocator_data); if (!stack) return NULL; #ifdef _WIN32 base.ptr = VirtualAlloc(NULL, max_limit, MEM_RESERVE, PAGE_READWRITE); if (!base.ptr) { - SLJIT_FREE(stack); + SLJIT_FREE(stack, allocator_data); return NULL; } stack->base = base.uw; stack->limit = stack->base; stack->max_limit = stack->base + max_limit; if (sljit_stack_resize(stack, stack->base + limit)) { - sljit_free_stack(stack); + sljit_free_stack(stack, allocator_data); return NULL; } #else @@ -255,14 +256,14 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_stack* SLJIT_CALL sljit_allocate_stack(slj #else if (dev_zero < 0) { if (open_dev_zero()) { - SLJIT_FREE(stack); + SLJIT_FREE(stack, allocator_data); return NULL; } } base.ptr = mmap(NULL, max_limit, PROT_READ | PROT_WRITE, MAP_PRIVATE, dev_zero, 0); #endif if (base.ptr == MAP_FAILED) { - SLJIT_FREE(stack); + SLJIT_FREE(stack, allocator_data); return NULL; } stack->base = base.uw; @@ -275,14 +276,15 @@ SLJIT_API_FUNC_ATTRIBUTE struct sljit_stack* SLJIT_CALL sljit_allocate_stack(slj #undef PAGE_ALIGN -SLJIT_API_FUNC_ATTRIBUTE void SLJIT_CALL sljit_free_stack(struct sljit_stack* stack) +SLJIT_API_FUNC_ATTRIBUTE void SLJIT_CALL sljit_free_stack(struct sljit_stack* stack, void *allocator_data) { + SLJIT_UNUSED_ARG(allocator_data); #ifdef _WIN32 VirtualFree((void*)stack->base, 0, MEM_RELEASE); #else munmap((void*)stack->base, stack->max_limit - stack->base); #endif - SLJIT_FREE(stack); + SLJIT_FREE(stack, allocator_data); } SLJIT_API_FUNC_ATTRIBUTE sljit_sw SLJIT_CALL sljit_stack_resize(struct sljit_stack* stack, sljit_uw new_limit) |