From 011dec28556aab1d3767c0eb4a81466e751cb522 Mon Sep 17 00:00:00 2001 From: kramm Date: Tue, 30 Dec 2008 22:55:03 +0000 Subject: [PATCH] reactivated code_dup --- lib/as3/code.c | 9 +++++---- lib/as3/code.h | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/as3/code.c b/lib/as3/code.c index bb59ede..e92d6c9 100644 --- a/lib/as3/code.c +++ b/lib/as3/code.c @@ -1048,16 +1048,13 @@ code_t* code_append(code_t*code, code_t*toappend) lookupswitch_t*lookupswitch_dup(lookupswitch_t*l) { lookupswitch_t*n = malloc(sizeof(lookupswitch_t)); - fprintf(stderr, "lookupswitch dupping not supported yet\n"); + fprintf(stderr, "Error: lookupswitch dupping not supported yet\n"); n->targets = list_clone(l->targets); return 0; } code_t*code_dup(code_t*c) { - /* misses branch relocation */ - fprintf(stderr, "dupping not supported yet\n"); - return 0; if(!c) return 0; while(c->prev) c = c->prev; @@ -1068,6 +1065,10 @@ code_t*code_dup(code_t*c) memcpy(n, c, sizeof(code_t)); opcode_t*op = opcode_get(c->opcode); + if(c->branch) { + fprintf(stderr, "Error: Can't duplicate branching code\n"); + return 0; + } char*p = op?op->params:""; int pos=0; while(*p) { diff --git a/lib/as3/code.h b/lib/as3/code.h index 885bfbe..6ae24b9 100644 --- a/lib/as3/code.h +++ b/lib/as3/code.h @@ -77,7 +77,7 @@ struct _codelookup { int len; }; -code_t*code_dup(code_t*c); //shallow copy +code_t*code_dup(code_t*c); code_t*add_opcode(code_t*atag, U8 op); -- 1.7.10.4