Scripting: Minor cleanup

This commit is contained in:
Vicki Pfau 2022-03-11 17:49:13 -08:00
parent 36efaf6330
commit 9d92c185c6
2 changed files with 5 additions and 6 deletions

View File

@ -23,11 +23,11 @@ CXX_GUARD_START
#define mSCRIPT_TYPE_C_S64 int64_t #define mSCRIPT_TYPE_C_S64 int64_t
#define mSCRIPT_TYPE_C_U64 uint64_t #define mSCRIPT_TYPE_C_U64 uint64_t
#define mSCRIPT_TYPE_C_F64 double #define mSCRIPT_TYPE_C_F64 double
#define mSCRIPT_TYPE_C_STR mScriptString* #define mSCRIPT_TYPE_C_STR struct mScriptString*
#define mSCRIPT_TYPE_C_CHARP const char* #define mSCRIPT_TYPE_C_CHARP const char*
#define mSCRIPT_TYPE_C_PTR void* #define mSCRIPT_TYPE_C_PTR void*
#define mSCRIPT_TYPE_C_TABLE Table* #define mSCRIPT_TYPE_C_TABLE Table*
#define mSCRIPT_TYPE_C_WRAPPER mScriptValue* #define mSCRIPT_TYPE_C_WRAPPER struct mScriptValue*
#define mSCRIPT_TYPE_C_S(STRUCT) struct STRUCT* #define mSCRIPT_TYPE_C_S(STRUCT) struct STRUCT*
#define mSCRIPT_TYPE_FIELD_S32 s32 #define mSCRIPT_TYPE_FIELD_S32 s32

View File

@ -598,11 +598,10 @@ void mScriptValueRef(struct mScriptValue* val) {
} }
void mScriptValueDeref(struct mScriptValue* val) { void mScriptValueDeref(struct mScriptValue* val) {
if (val->refs > 1) {
--val->refs; --val->refs;
if (val->refs > 0) {
return; return;
} else if (val->refs < 0) { } else if (val->refs <= 0) {
val->refs = mSCRIPT_VALUE_UNREF;
return; return;
} }
if (val->type->free) { if (val->type->free) {