MCPcopy Create free account
hub / github.com/GoogleChrome/samples / __allocMainArgv

Function __allocMainArgv

sqlite-wasm-cos/sqlite3-node.mjs:8446–8459  ·  view source on GitHub ↗
(isScoped, list)

Source from the content-addressed store, hash-verified

8444
8445 // impl for allocMainArgv() and scopedAllocMainArgv().
8446 const __allocMainArgv = function(isScoped, list){
8447 const pList = target[
8448 isScoped ? 'scopedAlloc' : 'alloc'
8449 ]((list.length + 1) * target.ptr.size);
8450 let i = 0;
8451 list.forEach((e)=>{
8452 target.pokePtr(__ptrAdd(pList, target.ptr.size * i++),
8453 target[
8454 isScoped ? 'scopedAllocCString' : 'allocCString'
8455 ](""+e));
8456 });
8457 target.pokePtr(__ptrAdd(pList, target.ptr.size * i), 0);
8458 return pList;
8459 };
8460
8461 /**
8462 Creates an array, using scopedAlloc(), suitable for passing to a

Callers 1

sqlite3InitModuleFunction · 0.70

Calls 1

__ptrAddFunction · 0.70

Tested by

no test coverage detected