| 463 | // |
| 464 | |
| 465 | void hstring::Init(const char *str) |
| 466 | { |
| 467 | if(!str) |
| 468 | { |
| 469 | mId=0; |
| 470 | return; |
| 471 | } |
| 472 | int hash=HashFunction(str); |
| 473 | int id=HashHelper().FindFirst(hash); |
| 474 | while (id) |
| 475 | { |
| 476 | assert(id>0&&id<ThePool().mNextStringId); |
| 477 | if (!strcmp(str,gCharPtrs[id])) |
| 478 | { |
| 479 | mId=id; |
| 480 | return; |
| 481 | } |
| 482 | id=HashHelper().FindNext(); |
| 483 | } |
| 484 | char *raw=ThePool().Alloc(strlen(str),mId); |
| 485 | strcpy(raw,str); |
| 486 | HashHelper().Add(hash,mId); |
| 487 | #ifdef _DEBUG |
| 488 | int test; |
| 489 | raw=TheDebugPool().Alloc(strlen(str),test); |
| 490 | assert(test==mId); |
| 491 | strcpy(raw,str); |
| 492 | #endif |
| 493 | |
| 494 | } |
| 495 | |
| 496 | const char *hstring::c_str(void) const |
| 497 | { |
nothing calls this directly
no test coverage detected