MCPcopy Create free account
hub / github.com/PhoneVR-Developers/PhoneVR / LocalArray

Method LocalArray

code/common/libs/ifaddrs/LocalArray.h:40–46  ·  view source on GitHub ↗

* Allocates a new fixed-size array of the given size. If this size is * less than or equal to the template parameter STACK_BYTE_COUNT, an * internal on-stack buffer will be used. Otherwise a heap buffer will * be allocated. */

Source from the content-addressed store, hash-verified

38 * be allocated.
39 */
40 LocalArray(size_t desiredByteCount) : mSize(desiredByteCount) {
41 if (desiredByteCount > STACK_BYTE_COUNT) {
42 mPtr = new char[mSize];
43 } else {
44 mPtr = &mOnStackBuffer[0];
45 }
46 }
47
48 /**
49 * Frees the heap-allocated buffer, if there was one.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected