MCPcopy Create free account
hub / github.com/KhronosGroup/KTX-Software / ktxMemStream_construct

Function ktxMemStream_construct

lib/memstream.c:482–500  ·  view source on GitHub ↗

* @~English * @brief Initialize a read-write ktxMemStream. * * Memory is allocated as data is written. The caller of this is * responsible for freeing this memory unless @a freeOnDestruct * is not KTX_FALSE. * * @param [in] str pointer to a ktxStream struct to initialize. * @param [in] freeOnDestruct If not KTX_FALSE memory holding the data will *

Source from the content-addressed store, hash-verified

480 * @exception KTX_OUT_OF_MEMORY system failed to allocate sufficient memory.
481 */
482KTX_error_code ktxMemStream_construct(ktxStream* str,
483 ktx_bool_t freeOnDestruct)
484{
485 ktxMem* mem;
486 KTX_error_code result = KTX_SUCCESS;
487
488 if (!str)
489 return KTX_INVALID_VALUE;
490
491 result = ktxMem_create(&mem);
492
493 if (KTX_SUCCESS == result) {
494 str->data.mem = mem;
495 ktxMemStream_setup(str);
496 str->closeOnDestruct = freeOnDestruct;
497 }
498
499 return result;
500}
501
502/**
503 * @~English

Callers 4

TESTFunction · 0.85

Calls 2

ktxMem_createFunction · 0.85
ktxMemStream_setupFunction · 0.85

Tested by 1

TESTFunction · 0.68