jscript: Use standard list for the queued code.
Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com> Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
9294823a7b
commit
5e4f0f4086
|
@ -185,7 +185,7 @@ typedef struct _bytecode_t {
|
||||||
unsigned str_pool_size;
|
unsigned str_pool_size;
|
||||||
unsigned str_cnt;
|
unsigned str_cnt;
|
||||||
|
|
||||||
struct _bytecode_t *next;
|
struct list entry;
|
||||||
} bytecode_t;
|
} bytecode_t;
|
||||||
|
|
||||||
HRESULT compile_script(script_ctx_t*,const WCHAR*,const WCHAR*,const WCHAR*,BOOL,BOOL,bytecode_t**) DECLSPEC_HIDDEN;
|
HRESULT compile_script(script_ctx_t*,const WCHAR*,const WCHAR*,const WCHAR*,BOOL,BOOL,bytecode_t**) DECLSPEC_HIDDEN;
|
||||||
|
|
|
@ -60,8 +60,7 @@ typedef struct {
|
||||||
|
|
||||||
IActiveScriptSite *site;
|
IActiveScriptSite *site;
|
||||||
|
|
||||||
bytecode_t *queue_head;
|
struct list queued_code;
|
||||||
bytecode_t *queue_tail;
|
|
||||||
} JScript;
|
} JScript;
|
||||||
|
|
||||||
void script_release(script_ctx_t *ctx)
|
void script_release(script_ctx_t *ctx)
|
||||||
|
@ -117,27 +116,19 @@ static HRESULT exec_global_code(JScript *This, bytecode_t *code)
|
||||||
|
|
||||||
static void clear_script_queue(JScript *This)
|
static void clear_script_queue(JScript *This)
|
||||||
{
|
{
|
||||||
bytecode_t *iter, *iter2;
|
while(!list_empty(&This->queued_code))
|
||||||
|
{
|
||||||
if(!This->queue_head)
|
bytecode_t *iter = LIST_ENTRY(list_head(&This->queued_code), bytecode_t, entry);
|
||||||
return;
|
list_remove(&iter->entry);
|
||||||
|
|
||||||
iter = This->queue_head;
|
|
||||||
while(iter) {
|
|
||||||
iter2 = iter->next;
|
|
||||||
iter->next = NULL;
|
|
||||||
release_bytecode(iter);
|
release_bytecode(iter);
|
||||||
iter = iter2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
This->queue_head = This->queue_tail = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void exec_queued_code(JScript *This)
|
static void exec_queued_code(JScript *This)
|
||||||
{
|
{
|
||||||
bytecode_t *iter;
|
bytecode_t *iter;
|
||||||
|
|
||||||
for(iter = This->queue_head; iter; iter = iter->next)
|
LIST_FOR_EACH_ENTRY(iter, &This->queued_code, bytecode_t, entry)
|
||||||
exec_global_code(This, iter);
|
exec_global_code(This, iter);
|
||||||
|
|
||||||
clear_script_queue(This);
|
clear_script_queue(This);
|
||||||
|
@ -793,10 +784,7 @@ static HRESULT WINAPI JScriptParse_ParseScriptText(IActiveScriptParse *iface,
|
||||||
* script is executed immediately, even if it's not in started state yet.
|
* script is executed immediately, even if it's not in started state yet.
|
||||||
*/
|
*/
|
||||||
if(!pvarResult && !is_started(This->ctx)) {
|
if(!pvarResult && !is_started(This->ctx)) {
|
||||||
if(This->queue_tail)
|
list_add_tail(&This->queued_code, &code->entry);
|
||||||
This->queue_tail = This->queue_tail->next = code;
|
|
||||||
else
|
|
||||||
This->queue_head = This->queue_tail = code;
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1089,6 +1077,7 @@ HRESULT create_jscript_object(BOOL is_encode, REFIID riid, void **ppv)
|
||||||
ret->ref = 1;
|
ret->ref = 1;
|
||||||
ret->safeopt = INTERFACE_USES_DISPEX;
|
ret->safeopt = INTERFACE_USES_DISPEX;
|
||||||
ret->is_encode = is_encode;
|
ret->is_encode = is_encode;
|
||||||
|
list_init(&ret->queued_code);
|
||||||
|
|
||||||
hres = IActiveScript_QueryInterface(&ret->IActiveScript_iface, riid, ppv);
|
hres = IActiveScript_QueryInterface(&ret->IActiveScript_iface, riid, ppv);
|
||||||
IActiveScript_Release(&ret->IActiveScript_iface);
|
IActiveScript_Release(&ret->IActiveScript_iface);
|
||||||
|
|
Loading…
Reference in New Issue