From 4b444c6ecac5287f20cfd87fe77e2c8f8d238924 Mon Sep 17 00:00:00 2001 From: q66 Date: Sat, 16 Jul 2016 19:54:30 +0100 Subject: [PATCH] get rid of some global state usage --- cubescript.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cubescript.cc b/cubescript.cc index 74cd9dae..7666b567 100644 --- a/cubescript.cc +++ b/cubescript.cc @@ -2448,7 +2448,7 @@ Bytecode &Bytecode::operator=(Bytecode &&v) { 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; for (;;) { 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_FLOAT: if (depth <= 0) { - if (&result != &no_ret) result.force(op & CODE_RET_MASK); + if (result) result->force(op & CODE_RET_MASK); return code; } --depth; @@ -2628,7 +2628,7 @@ static const ostd::Uint32 *runcode(CsState &cs, const ostd::Uint32 *code, Tagged result.set_null(); if (rundepth >= MAXRUNDEPTH) { cs_debug_code(cs, "exceeded recursion limit"); - return skipcode(code, result); + return skipcode(code, (&result == &no_ret) ? nullptr : &result); } ++rundepth; int numargs = 0;