(str)
| 10353 | to the configured dealloc() function. |
| 10354 | */ |
| 10355 | const __allocCString = function(str){ |
| 10356 | const u = __utf8Encoder.encode(str); |
| 10357 | const mem = alloc(u.length+1); |
| 10358 | if(!mem) toss("Allocation error while duplicating string:",str); |
| 10359 | const h = heap(); |
| 10360 | //let i = 0; |
| 10361 | //for( ; i < u.length; ++i ) h[mem + i] = u[i]; |
| 10362 | h.set(u, Number(mem)); |
| 10363 | h[__ptrAdd(mem, u.length)] = 0; |
| 10364 | //log("allocCString @",mem," =",u); |
| 10365 | return mem; |
| 10366 | }; |
| 10367 | |
| 10368 | /** |
| 10369 | Sets the given struct member of obj to a dynamically-allocated, |
no test coverage detected