From c9e688207a648dd949c61834eb7bad937a9f0142 Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Sat, 10 Aug 2024 16:47:48 +0800 Subject: [PATCH] ... --- include/pocketpy/pocketpy.h | 6 +++--- src/public/modules.c | 12 +++--------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/include/pocketpy/pocketpy.h b/include/pocketpy/pocketpy.h index 9591bd56..58ee8990 100644 --- a/include/pocketpy/pocketpy.h +++ b/include/pocketpy/pocketpy.h @@ -242,11 +242,11 @@ py_GlobalRef py_getreg(int i); void py_setreg(int i, py_Ref val); /// Get variable in the `__main__` module. -py_GlobalRef py_getglobal(const char* name); +py_GlobalRef py_getglobal(py_Name name); /// Set variable in the `__main__` module. -void py_setglobal(const char* name, py_Ref val); +void py_setglobal(py_Name name, py_Ref val); /// Get variable in the `builtins` module. -py_GlobalRef py_getbuiltin(const char* name); +py_GlobalRef py_getbuiltin(py_Name name); /// Equivalent to `*dst = *src`. void py_assign(py_Ref dst, py_Ref src); diff --git a/src/public/modules.c b/src/public/modules.c index 75d8ed57..b01d5751 100644 --- a/src/public/modules.c +++ b/src/public/modules.c @@ -13,17 +13,11 @@ py_Ref py_getmodule(const char* path) { return NameDict__try_get(&vm->modules, py_name(path)); } -py_Ref py_getbuiltin(const char* name){ - return py_getdict(&pk_current_vm->builtins, py_name(name)); -} +py_Ref py_getbuiltin(py_Name name) { return py_getdict(&pk_current_vm->builtins, name); } -py_Ref py_getglobal(const char* name){ - return py_getdict(&pk_current_vm->main, py_name(name)); -} +py_Ref py_getglobal(py_Name name) { return py_getdict(&pk_current_vm->main, name); } -void py_setglobal(const char* name, py_Ref val){ - py_setdict(&pk_current_vm->main, py_name(name), val); -} +void py_setglobal(py_Name name, py_Ref val) { py_setdict(&pk_current_vm->main, name, val); } py_Ref py_newmodule(const char* path) { ManagedHeap* heap = &pk_current_vm->heap;