Decrement the routine's use count.
| 257 | |
| 258 | // Decrement the routine's use count. |
| 259 | void Routine::release(thread_db* tdbb) |
| 260 | { |
| 261 | // Actually, it's possible for routines to have intermixed dependencies, so |
| 262 | // this routine can be called for the routine which is being freed itself. |
| 263 | // Hence we should just silently ignore such a situation. |
| 264 | |
| 265 | if (!useCount) |
| 266 | return; |
| 267 | |
| 268 | if (intUseCount > 0) |
| 269 | intUseCount--; |
| 270 | |
| 271 | --useCount; |
| 272 | |
| 273 | #ifdef DEBUG_PROCS |
| 274 | { |
| 275 | string buffer; |
| 276 | buffer.printf( |
| 277 | "Called from CMP_decrement():\n\t Decrementing use count of %s\n", |
| 278 | getName().toString().c_str()); |
| 279 | JRD_print_procedure_info(tdbb, buffer.c_str()); |
| 280 | } |
| 281 | #endif |
| 282 | |
| 283 | // Call recursively if and only if the use count is zero AND the routine |
| 284 | // in the cache is different than this routine. |
| 285 | // The routine will be different than in the cache only if it is a |
| 286 | // floating copy, i.e. an old copy or a deleted routine. |
| 287 | if (useCount == 0 && !checkCache(tdbb)) |
| 288 | { |
| 289 | if (getStatement()) |
| 290 | releaseStatement(tdbb); |
| 291 | |
| 292 | flags &= ~Routine::FLAG_BEING_ALTERED; |
| 293 | remove(tdbb); |
| 294 | } |
| 295 | } |
| 296 | |
| 297 | void Routine::releaseStatement(thread_db* tdbb) |
| 298 | { |
no test coverage detected