(str)
| 10232 | to the configured dealloc() function. |
| 10233 | */ |
| 10234 | const __allocCString = function(str){ |
| 10235 | const u = __utf8Encoder.encode(str); |
| 10236 | const mem = alloc(u.length+1); |
| 10237 | if(!mem) toss("Allocation error while duplicating string:",str); |
| 10238 | const h = heap(); |
| 10239 | //let i = 0; |
| 10240 | //for( ; i < u.length; ++i ) h[mem + i] = u[i]; |
| 10241 | h.set(u, Number(mem)); |
| 10242 | h[__ptrAdd(mem, u.length)] = 0; |
| 10243 | //log("allocCString @",mem," =",u); |
| 10244 | return mem; |
| 10245 | }; |
| 10246 | |
| 10247 | /** |
| 10248 | Sets the given struct member of obj to a dynamically-allocated, |
no test coverage detected