MCPcopy Create free account
hub / github.com/Kitware/VTK / pj_insert_initcache

Function pj_insert_initcache

ThirdParty/libproj/vtklibproj/src/initcache.cpp:141–189  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

139/************************************************************************/
140
141void pj_insert_initcache( const char *filekey, const paralist *list )
142
143{
144 pj_acquire_lock();
145
146 /*
147 ** Grow list if required.
148 */
149 if( cache_count == cache_alloc )
150 {
151 char **cache_key_new;
152 paralist **cache_paralist_new;
153
154 cache_alloc = cache_alloc * 2 + 15;
155
156 cache_key_new = (char **) malloc(sizeof(char*) * cache_alloc);
157 assert(cache_key_new);
158 if( cache_key && cache_count )
159 {
160 memcpy( cache_key_new, cache_key, sizeof(char*) * cache_count);
161 }
162 free( cache_key );
163 cache_key = cache_key_new;
164
165 cache_paralist_new = (paralist **)
166 malloc(sizeof(paralist*) * cache_alloc);
167 assert(cache_paralist_new);
168 if( cache_paralist && cache_count )
169 {
170 memcpy( cache_paralist_new, cache_paralist,
171 sizeof(paralist*) * cache_count );
172 }
173 free( cache_paralist );
174 cache_paralist = cache_paralist_new;
175 }
176
177 /*
178 ** Duplicate the filekey and paralist, and insert in cache.
179 */
180 cache_key[cache_count] = (char *) malloc(strlen(filekey)+1);
181 assert(cache_key[cache_count]);
182 strcpy( cache_key[cache_count], filekey );
183
184 cache_paralist[cache_count] = pj_clone_paralist( list );
185
186 cache_count++;
187
188 pj_release_lock();
189}
190

Callers 1

get_initFunction · 0.85

Calls 4

pj_acquire_lockFunction · 0.85
pj_clone_paralistFunction · 0.85
pj_release_lockFunction · 0.85
assertFunction · 0.50

Tested by

no test coverage detected