diff --git a/src/base64.h b/src/base64.h index 11315e9c..51c5aa54 100644 --- a/src/base64.h +++ b/src/base64.h @@ -7,12 +7,12 @@ namespace pkpy { // https://github.com/zhicheng/base64/blob/master/base64.c -inline static const char BASE64_PAD = '='; -inline static const char BASE64DE_FIRST = '+'; -inline static const char BASE64DE_LAST = 'z'; +const char BASE64_PAD = '='; +const char BASE64DE_FIRST = '+'; +const char BASE64DE_LAST = 'z'; /* BASE 64 encode table */ -static const char base64en[] = { +const char base64en[] = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', @@ -24,7 +24,7 @@ static const char base64en[] = { }; /* ASCII order for BASE 64 decode, 255 in unused character */ -static const unsigned char base64de[] = { +const unsigned char base64de[] = { /* nul, soh, stx, etx, eot, enq, ack, bel, */ 255, 255, 255, 255, 255, 255, 255, 255, diff --git a/src/ceval.h b/src/ceval.h index 549a1c16..584d716a 100644 --- a/src/ceval.h +++ b/src/ceval.h @@ -106,7 +106,7 @@ __NEXT_STEP:; TARGET(LOAD_FAST) { heap._auto_collect(); _0 = frame->_locals[byte.arg]; - if(_0 == nullptr) vm->NameError(co->varnames[byte.arg]); + if(_0 == PY_NULL) vm->NameError(co->varnames[byte.arg]); PUSH(_0); } DISPATCH(); TARGET(LOAD_NAME) @@ -195,8 +195,8 @@ __NEXT_STEP:; DISPATCH(); TARGET(DELETE_FAST) _0 = frame->_locals[byte.arg]; - if(_0 == nullptr) vm->NameError(co->varnames[byte.arg]); - frame->_locals[byte.arg] = nullptr; + if(_0 == PY_NULL) vm->NameError(co->varnames[byte.arg]); + frame->_locals[byte.arg] = PY_NULL; DISPATCH(); TARGET(DELETE_NAME) _name = StrName(byte.arg); diff --git a/src/common.h b/src/common.h index 4fbabba4..bef0fafa 100644 --- a/src/common.h +++ b/src/common.h @@ -158,7 +158,7 @@ inline bool is_both_int(PyObject* a, PyObject* b) noexcept { } // special singals, is_tagged() for them is true -inline PyObject* const PY_NULL = (PyObject*)0b000011; +inline PyObject* const PY_NULL = (PyObject*)0b000011; // tagged null inline PyObject* const PY_BEGIN_CALL = (PyObject*)0b010011; inline PyObject* const PY_OP_CALL = (PyObject*)0b100011; inline PyObject* const PY_OP_YIELD = (PyObject*)0b110011; diff --git a/src/vm.h b/src/vm.h index dd6435f5..a2a8cdc5 100644 --- a/src/vm.h +++ b/src/vm.h @@ -1215,7 +1215,7 @@ inline PyObject* VM::_py_call(PyObject** p0, PyObject* callable, ArgsView args, if(fn.is_simple){ if(args.size() > fn.argc) TypeError("too many positional arguments"); int spaces = co_nlocals - fn.argc; - for(int j=0; jargs) buffer[index] = args[i++]; // set extra varnames to nullptr - for(int j=i; jkwargs) buffer[kv.key] = kv.value; @@ -1400,7 +1400,7 @@ inline void VM::_error(Exception e){ inline void ManagedHeap::mark() { for(PyObject* obj: _no_gc) OBJ_MARK(obj); for(auto& frame : vm->callstack.data()) frame._gc_mark(); - for(PyObject* obj: vm->s_data) if(obj!=nullptr) OBJ_MARK(obj); + for(PyObject* obj: vm->s_data) OBJ_MARK(obj); if(vm->_gc_marker_ex != nullptr) vm->_gc_marker_ex(vm); }