diff --git a/3rd/cjson/src/cJSONw.cpp b/3rd/cjson/src/cJSONw.cpp index 0c0e1fe5..af3bf6aa 100644 --- a/3rd/cjson/src/cJSONw.cpp +++ b/3rd/cjson/src/cJSONw.cpp @@ -113,6 +113,12 @@ static PyObject* convert_cjson_to_python_object(const cJSON * const item, VM* vm void add_module_cjson(VM* vm){ PyObject* mod = vm->new_module("cjson"); + + PK_LOCAL_STATIC cJSON_Hooks hooks; + hooks.malloc_fn = pool64_alloc; + hooks.free_fn = pool64_dealloc; + cJSON_InitHooks(&hooks); + vm->bind_func<1>(mod, "loads", [](VM* vm, ArgsView args){ const Str& string = CAST(Str&, args[0]); cJSON *json = cJSON_ParseWithLength(string.data, string.size); diff --git a/cmake_build.py b/cmake_build.py index 7046f0d5..16f9d727 100644 --- a/cmake_build.py +++ b/cmake_build.py @@ -7,11 +7,9 @@ if not os.path.exists("build"): os.chdir("build") -code = os.system(r""" -cmake .. -DPK_USE_CJSON=ON -DPK_USE_BOX2D=ON -cmake --build . --config Release -""") - +code = os.system("cmake .. -DPK_USE_CJSON=ON -DPK_USE_BOX2D=ON") +assert code == 0 +code = os.system("cmake --build . --config Release") assert code == 0 if sys.platform == "win32":