Jacek Caban : jscript: Fixed jsheap_grow implementation.
Alexandre Julliard
julliard at winehq.org
Mon Apr 2 13:14:49 CDT 2012
Module: wine
Branch: master
Commit: b3bafb60a278bfe23d67923d399d46f2da11dd46
URL: http://source.winehq.org/git/wine.git/?a=commit;h=b3bafb60a278bfe23d67923d399d46f2da11dd46
Author: Jacek Caban <jacek at codeweavers.com>
Date: Fri Mar 30 18:19:48 2012 +0200
jscript: Fixed jsheap_grow implementation.
---
dlls/jscript/jsutils.c | 7 ++++++-
dlls/jscript/tests/regexp.js | 4 ++++
2 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/dlls/jscript/jsutils.c b/dlls/jscript/jsutils.c
index 040ec58..5e5121a 100644
--- a/dlls/jscript/jsutils.c
+++ b/dlls/jscript/jsutils.c
@@ -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 *ret;
+
if(mem == (BYTE*)heap->blocks[heap->last_block] + heap->offset-size
&& heap->offset+inc < block_size(heap->last_block)) {
heap->offset += inc;
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)
diff --git a/dlls/jscript/tests/regexp.js b/dlls/jscript/tests/regexp.js
index 4d513e0..e9f26ef 100644
--- a/dlls/jscript/tests/regexp.js
+++ b/dlls/jscript/tests/regexp.js
@@ -44,6 +44,10 @@ ok(m[0] === "aa", "m[0] = " + m[0]);
ok(RegExp.leftContext === " ", "RegExp.leftContext = " + RegExp.leftContext);
ok(RegExp.rightContext === "baaa", "RegExp.rightContext = " + RegExp.rightContext);
+m = /^[^<]*(<(.|\s)+>)[^>]*$|^#(\w+)$/.exec(
+ "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
+ok(m === null, "m is not null");
+
re = /a+/g;
ok(re.lastIndex === 0, "re.lastIndex = " + re.lastIndex);
More information about the wine-cvs
mailing list