| 337 | } |
| 338 | |
| 339 | char *Alloc(int sizeBytes,int &id) |
| 340 | { |
| 341 | // Can't alloc more than MAX_HSTRINGS. |
| 342 | assert(mNextStringId<MAX_HSTRINGS); |
| 343 | char *raw=0; |
| 344 | if (mLastBlockNum>=0) |
| 345 | { |
| 346 | // Get the pointer to the start of allocated space in the current block. |
| 347 | raw=mBlockVec[mLastBlockNum]->Alloc(sizeBytes); |
| 348 | } |
| 349 | if(!raw) |
| 350 | { |
| 351 | // Ok, make a new empty block and append it. |
| 352 | CHSBlock *block=new(CHSBlock); |
| 353 | mBlockVec.push_back(block); |
| 354 | mLastBlockNum++; |
| 355 | raw=mBlockVec[mLastBlockNum]->Alloc(sizeBytes); |
| 356 | } |
| 357 | // Should never really happen!! |
| 358 | assert(raw); |
| 359 | |
| 360 | id=mNextStringId; |
| 361 | gCharPtrs[mNextStringId]=raw; |
| 362 | mNextStringId++; |
| 363 | |
| 364 | return(raw); |
| 365 | } |
| 366 | |
| 367 | bool operator== (const CPool &pool) const |
| 368 | { |