get rid of some global state usage

master
Daniel Kolesa 2016-07-16 19:54:30 +01:00
parent 6f14783bd3
commit 4b444c6eca
1 changed files with 3 additions and 3 deletions

View File

@ -2448,7 +2448,7 @@ Bytecode &Bytecode::operator=(Bytecode &&v) {
return *this; return *this;
} }
static const ostd::Uint32 *skipcode(const ostd::Uint32 *code, TaggedValue &result = no_ret) { static const ostd::Uint32 *skipcode(const ostd::Uint32 *code, TaggedValue *result = nullptr) {
int depth = 0; int depth = 0;
for (;;) { for (;;) {
ostd::Uint32 op = *code++; ostd::Uint32 op = *code++;
@ -2478,7 +2478,7 @@ static const ostd::Uint32 *skipcode(const ostd::Uint32 *code, TaggedValue &resul
case CODE_EXIT|RET_INT: case CODE_EXIT|RET_INT:
case CODE_EXIT|RET_FLOAT: case CODE_EXIT|RET_FLOAT:
if (depth <= 0) { if (depth <= 0) {
if (&result != &no_ret) result.force(op & CODE_RET_MASK); if (result) result->force(op & CODE_RET_MASK);
return code; return code;
} }
--depth; --depth;
@ -2628,7 +2628,7 @@ static const ostd::Uint32 *runcode(CsState &cs, const ostd::Uint32 *code, Tagged
result.set_null(); result.set_null();
if (rundepth >= MAXRUNDEPTH) { if (rundepth >= MAXRUNDEPTH) {
cs_debug_code(cs, "exceeded recursion limit"); cs_debug_code(cs, "exceeded recursion limit");
return skipcode(code, result); return skipcode(code, (&result == &no_ret) ? nullptr : &result);
} }
++rundepth; ++rundepth;
int numargs = 0; int numargs = 0;