MCPcopy Create free account
hub / github.com/DFHack/dfhack / alloc_string_sized

Function alloc_string_sized

depends/lodepng/lodepng.cpp:303–310  ·  view source on GitHub ↗

also appends null termination character*/

Source from the content-addressed store, hash-verified

301
302/*also appends null termination character*/
303static char* alloc_string_sized(const char* in, size_t insize) {
304 char* out = (char*)lodepng_malloc(insize + 1);
305 if(out) {
306 lodepng_memcpy(out, in, insize);
307 out[insize] = 0;
308 }
309 return out;
310}
311
312/* dynamically allocates a new string with a copy of the null terminated input text */
313static char* alloc_string(const char* in) {

Callers 3

alloc_stringFunction · 0.85
lodepng_add_text_sizedFunction · 0.85
lodepng_add_itext_sizedFunction · 0.85

Calls 2

lodepng_mallocFunction · 0.85
lodepng_memcpyFunction · 0.85

Tested by

no test coverage detected