| 376 | |
| 377 | |
| 378 | PathNode* PathNodePool::Alloc() |
| 379 | { |
| 380 | if ( freeMemSentinel.next == &freeMemSentinel ) { |
| 381 | MPASSERT( nAvailable == 0 ); |
| 382 | |
| 383 | Block* b = NewBlock(); |
| 384 | b->nextBlock = blocks; |
| 385 | blocks = b; |
| 386 | MPASSERT( freeMemSentinel.next != &freeMemSentinel ); |
| 387 | } |
| 388 | PathNode* pathNode = freeMemSentinel.next; |
| 389 | pathNode->Unlink(); |
| 390 | |
| 391 | ++nAllocated; |
| 392 | MPASSERT( nAvailable > 0 ); |
| 393 | --nAvailable; |
| 394 | return pathNode; |
| 395 | } |
| 396 | |
| 397 | |
| 398 | void PathNodePool::AddPathNode( unsigned key, PathNode* root ) |