From 2910776f8c0efa001c9c16866fce09b4071e9f16 Mon Sep 17 00:00:00 2001 From: Jan Wielemaker Date: Thu, 21 Nov 2024 17:48:09 +0100 Subject: [PATCH] PORT: WASM: Get rid of deprecated allocate, ALLOC_NORMAL and ALLOC_STACK --- src/wasm/prolog.js | 7 ++++--- src/wasm/runtime_exports.json | 2 -- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/wasm/prolog.js b/src/wasm/prolog.js index 84a71244f3..17f1820a02 100644 --- a/src/wasm/prolog.js +++ b/src/wasm/prolog.js @@ -174,9 +174,10 @@ class Prolog { let argv0 = this.args || []; argv0.unshift("swipl"); let argv = argv0.map(function(arg) { - return this.module.allocate( - this.module.intArrayFromString(arg), - 'i8', this.module.ALLOC_NORMAL); + const len = lengthBytesUTF8(arg); + const s = _malloc(len+1); + stringToUTF8(arg, s, len); + return s; }, this); var ptr = _malloc(argv.length * 4); argv.forEach(function(arg, i) { diff --git a/src/wasm/runtime_exports.json b/src/wasm/runtime_exports.json index 1398854659..1ce8af5bc1 100644 --- a/src/wasm/runtime_exports.json +++ b/src/wasm/runtime_exports.json @@ -2,9 +2,7 @@ "FS", "cwrap", "intArrayFromString", - "allocate", "setValue", - "ALLOC_NORMAL", "getValue", "UTF8ToString", "lengthBytesUTF8",