MCPcopy Create free account
hub / github.com/creatale/node-dv / icvDestroyMemStorage

Function icvDestroyMemStorage

deps/opencv/modules/core/src/datastructs.cpp:125–169  ·  view source on GitHub ↗

Release all blocks of the storage (or return them to parent, if any): */

Source from the content-addressed store, hash-verified

123
124/* Release all blocks of the storage (or return them to parent, if any): */
125static void
126icvDestroyMemStorage( CvMemStorage* storage )
127{
128 int k = 0;
129
130 CvMemBlock *block;
131 CvMemBlock *dst_top = 0;
132
133 if( !storage )
134 CV_Error( CV_StsNullPtr, "" );
135
136 if( storage->parent )
137 dst_top = storage->parent->top;
138
139 for( block = storage->bottom; block != 0; k++ )
140 {
141 CvMemBlock *temp = block;
142
143 block = block->next;
144 if( storage->parent )
145 {
146 if( dst_top )
147 {
148 temp->prev = dst_top;
149 temp->next = dst_top->next;
150 if( temp->next )
151 temp->next->prev = temp;
152 dst_top = dst_top->next = temp;
153 }
154 else
155 {
156 dst_top = storage->parent->bottom = storage->parent->top = temp;
157 temp->prev = temp->next = 0;
158 storage->free_space = storage->block_size - sizeof( *temp );
159 }
160 }
161 else
162 {
163 cvFree( &temp );
164 }
165 }
166
167 storage->top = storage->bottom = 0;
168 storage->free_space = 0;
169}
170
171
172/* Release memory storage: */

Callers 2

cvReleaseMemStorageFunction · 0.85
cvClearMemStorageFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected