Skip to content

Commit

Permalink
PORT: WASM: Get rid of deprecated allocate, ALLOC_NORMAL and ALLOC_STACK
Browse files Browse the repository at this point in the history
  • Loading branch information
JanWielemaker committed Nov 21, 2024
1 parent d5192b2 commit 2910776
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/wasm/prolog.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 0 additions & 2 deletions src/wasm/runtime_exports.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
"FS",
"cwrap",
"intArrayFromString",
"allocate",
"setValue",
"ALLOC_NORMAL",
"getValue",
"UTF8ToString",
"lengthBytesUTF8",
Expand Down

0 comments on commit 2910776

Please sign in to comment.