MCPcopy Create free account
hub / github.com/LemonOSProject/LemonOS / reserve

Method reserve

Kernel/include/vector.h:92–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90 }
91
92 void reserve(size_t count){
93 acquireLock(&lock);
94 if(count > capacity){
95 capacity = count + 1;
96 }
97
98 if(data){
99 T* oldData = data;
100
101 data = new T[capacity];
102
103 for(unsigned i = 0; i < count; i++){
104 data[i] = oldData[i];
105 }
106
107 delete[] oldData;
108 } else {
109 data = new T[capacity];
110 }
111 releaseLock(&lock);
112 }
113
114 T& add_back(T val){
115 acquireLock(&lock);

Callers 1

GetInodeBlocksMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected