(jstr, returnWithLength, allocator, funcName)
| 8286 | }; |
| 8287 | |
| 8288 | const __allocCStr = function(jstr, returnWithLength, allocator, funcName){ |
| 8289 | __affirmAlloc(target, funcName); |
| 8290 | if('string'!==typeof jstr) return null; |
| 8291 | const u = cache.utf8Encoder.encode(jstr), |
| 8292 | ptr = allocator(u.length+1); |
| 8293 | let toFree = ptr; |
| 8294 | try{ |
| 8295 | const heap = heapWrappers().HEAP8U; |
| 8296 | heap.set(u, Number(ptr)); |
| 8297 | heap[__ptrAdd(ptr, u.length)] = 0; |
| 8298 | toFree = __NullPtr; |
| 8299 | return returnWithLength ? [ptr, u.length] : ptr; |
| 8300 | }finally{ |
| 8301 | if( toFree ) target.dealloc(toFree); |
| 8302 | } |
| 8303 | }; |
| 8304 | |
| 8305 | /** |
| 8306 | Uses target.alloc() to allocate enough memory for jstrlen(jstr)+1 |
no test coverage detected