Commit b3bafb60 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

jscript: Fixed jsheap_grow implementation.

parent f01cd3a3
...@@ -126,13 +126,18 @@ void *jsheap_alloc(jsheap_t *heap, DWORD size) ...@@ -126,13 +126,18 @@ void *jsheap_alloc(jsheap_t *heap, DWORD size)
void *jsheap_grow(jsheap_t *heap, void *mem, DWORD size, DWORD inc) void *jsheap_grow(jsheap_t *heap, void *mem, DWORD size, DWORD inc)
{ {
void *ret;
if(mem == (BYTE*)heap->blocks[heap->last_block] + heap->offset-size if(mem == (BYTE*)heap->blocks[heap->last_block] + heap->offset-size
&& heap->offset+inc < block_size(heap->last_block)) { && heap->offset+inc < block_size(heap->last_block)) {
heap->offset += inc; heap->offset += inc;
return mem; return mem;
} }
return jsheap_alloc(heap, size+inc); ret = jsheap_alloc(heap, size+inc);
if(ret) /* FIXME: avoid coppying for custom blocks */
memcpy(ret, mem, size);
return ret;
} }
void jsheap_clear(jsheap_t *heap) void jsheap_clear(jsheap_t *heap)
......
...@@ -44,6 +44,10 @@ ok(m[0] === "aa", "m[0] = " + m[0]); ...@@ -44,6 +44,10 @@ ok(m[0] === "aa", "m[0] = " + m[0]);
ok(RegExp.leftContext === " ", "RegExp.leftContext = " + RegExp.leftContext); ok(RegExp.leftContext === " ", "RegExp.leftContext = " + RegExp.leftContext);
ok(RegExp.rightContext === "baaa", "RegExp.rightContext = " + RegExp.rightContext); ok(RegExp.rightContext === "baaa", "RegExp.rightContext = " + RegExp.rightContext);
m = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/.exec(
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
ok(m === null, "m is not null");
re = /a+/g; re = /a+/g;
ok(re.lastIndex === 0, "re.lastIndex = " + re.lastIndex); ok(re.lastIndex === 0, "re.lastIndex = " + re.lastIndex);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment