remove py_assign

This commit is contained in:
blueloveTH 2025-06-07 01:49:18 +08:00
parent 67296767c7
commit ba058ba331
2 changed files with 6 additions and 9 deletions

View File

@ -29,9 +29,9 @@ typedef double py_f64;
typedef void (*py_Dtor)(void*); typedef void (*py_Dtor)(void*);
#ifdef PK_IS_PUBLIC_INCLUDE #ifdef PK_IS_PUBLIC_INCLUDE
typedef struct py_TValue { typedef struct py_TValue {
char _[16]; char _[16];
} py_TValue; } py_TValue;
#endif #endif
/// A string view type. It is helpful for passing strings which are not null-terminated. /// A string view type. It is helpful for passing strings which are not null-terminated.
@ -378,8 +378,6 @@ PK_API void py_setglobal(py_Name name, py_Ref val);
/// Get variable in the `builtins` module. /// Get variable in the `builtins` module.
PK_API py_ItemRef py_getbuiltin(py_Name name); PK_API py_ItemRef py_getbuiltin(py_Name name);
/// Equivalent to `*dst = *src`.
PK_API void py_assign(py_Ref dst, py_Ref src);
/// Get the last return value. /// Get the last return value.
PK_API py_GlobalRef py_retval(); PK_API py_GlobalRef py_retval();
@ -455,8 +453,9 @@ PK_API void py_bindmagic(py_Type type, py_Name name, py_CFunction f);
#define PY_CHECK_ARG_TYPE(i, type) \ #define PY_CHECK_ARG_TYPE(i, type) \
if(!py_checktype(py_arg(i), type)) return false if(!py_checktype(py_arg(i), type)) return false
#define py_offset(p, i) ((py_Ref)((char*)p + ((i) << 4))) #define py_offset(p, i) ((p) + (i))
#define py_arg(i) py_offset(argv, i) #define py_arg(i) (&argv[i])
#define py_assign(dst, src) *(dst) = *(src)
/************* Python Equivalents *************/ /************* Python Equivalents *************/

View File

@ -68,8 +68,6 @@ py_GlobalRef py_inspect_currentmodule() {
py_Frame* py_inspect_currentframe() { return pk_current_vm->top_frame; } py_Frame* py_inspect_currentframe() { return pk_current_vm->top_frame; }
void py_assign(py_Ref dst, py_Ref src) { *dst = *src; }
/* Stack References */ /* Stack References */
py_Ref py_peek(int i) { py_Ref py_peek(int i) {
assert(i <= 0); assert(i <= 0);