MCPcopy Create free account
hub / github.com/HaxeFoundation/hxcpp / safeReserveExtra

Method safeReserveExtra

include/hx/QuickVec.h:56–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54 }
55
56 bool safeReserveExtra(int inN)
57 {
58 int want = mSize + inN;
59 if (want>mAlloc)
60 {
61 int wantAlloc = 10 + (mSize*3/2);
62 if (wantAlloc<want)
63 wantAlloc = want;
64 T *newBuffer = (T *)malloc( sizeof(T)*wantAlloc );
65 if (!newBuffer)
66 return false;
67 mAlloc = wantAlloc;
68 if (mPtr)
69 {
70 memcpy(newBuffer, mPtr, mSize*sizeof(T));
71 free(mPtr);
72 }
73 mPtr = newBuffer;
74 }
75 return true;
76 }
77 inline void pop_back() { --mSize; }
78 inline T &back() { return mPtr[mSize-1]; }
79 inline T pop()

Callers 3

__hxt_gc_after_markFunction · 0.80
AllocMoreBlocksMethod · 0.80
createFreeListMethod · 0.80

Calls 1

memcpyFunction · 0.85

Tested by

no test coverage detected