This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Functions | |
ATTR * | vattr_rename_LEN (char *, int, char *, int) |
ATTR * | vattr_find_LEN (const char *pAttrName, size_t nAttrName) |
ATTR * | vattr_alloc_LEN (char *pAttrName, size_t nAttrName, int flags) |
ATTR * | vattr_define_LEN (char *pAttrName, size_t nAttrName, int number, int flags) |
void | vattr_delete_LEN (char *, int) |
ATTR * | vattr_first (void) |
ATTR * | vattr_next (ATTR *) |
void | list_vhashstats (dbref) |
void list_vhashstats | ( | dbref | ) |
ATTR* vattr_alloc_LEN | ( | char * | pAttrName, | |
size_t | nAttrName, | |||
int | flags | |||
) |
Definition at line 54 of file vattr.cpp.
References anum_extend(), statedata::attr_next, mudstate, and vattr_define_LEN().
Referenced by mkattr().
00055 { 00056 int number = mudstate.attr_next++; 00057 anum_extend(number); 00058 return vattr_define_LEN(pName, nName, number, flags); 00059 }
ATTR* vattr_define_LEN | ( | char * | pAttrName, | |
size_t | nAttrName, | |||
int | number, | |||
int | flags | |||
) |
Definition at line 61 of file vattr.cpp.
References anum_extend(), anum_set, attr::flags, HASH_ProcessBuffer(), CHashTable::Insert(), ISOUTOFMEMORY, MEMALLOC, mudstate, attr::name, attr::number, store_string(), vattr_find_LEN(), and statedata::vattr_name_htab.
Referenced by db_read(), dbclean_CheckALISTtoAT(), and vattr_alloc_LEN().
00062 { 00063 ATTR *vp = vattr_find_LEN(pName, nName); 00064 if (vp) 00065 { 00066 return vp; 00067 } 00068 00069 vp = (ATTR *)MEMALLOC(sizeof(ATTR)); 00070 ISOUTOFMEMORY(vp); 00071 00072 // NOTE: By using store_string, the only way to release the 00073 // memory associated with a user attribute name is to @restart 00074 // the game. 00075 // 00076 vp->name = store_string(pName); 00077 vp->flags = flags; 00078 vp->number = number; 00079 00080 // This entry cannot already be in the hash table because we've checked it 00081 // above with vattr_find_LEN. 00082 // 00083 UINT32 nHash = HASH_ProcessBuffer(0, pName, nName); 00084 mudstate.vattr_name_htab.Insert(sizeof(number), nHash, &number); 00085 00086 anum_extend(vp->number); 00087 anum_set(vp->number, (ATTR *) vp); 00088 return vp; 00089 }
void vattr_delete_LEN | ( | char * | , | |
int | ||||
) |
Definition at line 624 of file vattr.cpp.
References anum_set, anum_table, CHashTable::Copy(), CHashTable::FindFirstKey(), CHashTable::FindNextKey(), HASH_ProcessBuffer(), HF_FIND_END, MEMFREE, mudstate, CHashTable::Remove(), and statedata::vattr_name_htab.
Referenced by do_attribute().
00625 { 00626 // Delete from hashtable. 00627 // 00628 UINT32 nHash = HASH_ProcessBuffer(0, pName, nName); 00629 CHashTable *pht = &mudstate.vattr_name_htab; 00630 HP_DIRINDEX iDir = pht->FindFirstKey(nHash); 00631 while (iDir != HF_FIND_END) 00632 { 00633 HP_HEAPLENGTH nRecord; 00634 int anum; 00635 pht->Copy(iDir, &nRecord, &anum); 00636 if (strcmp(pName, anum_table[anum]->name) == 0) 00637 { 00638 ATTR *vp = (ATTR *)anum_table[anum]; 00639 anum_set(anum, NULL); 00640 pht->Remove(iDir); 00641 MEMFREE(vp); 00642 vp = NULL; 00643 } 00644 iDir = pht->FindNextKey(iDir, nHash); 00645 } 00646 }
ATTR* vattr_find_LEN | ( | const char * | pAttrName, | |
size_t | nAttrName | |||
) |
Definition at line 33 of file vattr.cpp.
References anum_table, CHashTable::Copy(), CHashTable::FindFirstKey(), CHashTable::FindNextKey(), HASH_ProcessBuffer(), HF_FIND_END, mudstate, attr::name, and statedata::vattr_name_htab.
Referenced by atr_str(), dbclean_CheckATtoANH(), do_attribute(), and vattr_define_LEN().
00034 { 00035 UINT32 nHash = HASH_ProcessBuffer(0, pAttrName, nAttrName); 00036 00037 CHashTable *pht = &mudstate.vattr_name_htab; 00038 HP_DIRINDEX iDir = pht->FindFirstKey(nHash); 00039 while (iDir != HF_FIND_END) 00040 { 00041 HP_HEAPLENGTH nRecord; 00042 int anum; 00043 pht->Copy(iDir, &nRecord, &anum); 00044 ATTR *va = (ATTR *)anum_table[anum]; 00045 if (strcmp(pAttrName, va->name) == 0) 00046 { 00047 return va; 00048 } 00049 iDir = pht->FindNextKey(iDir, nHash); 00050 } 00051 return NULL; 00052 }
ATTR* vattr_first | ( | void | ) |
Definition at line 678 of file vattr.cpp.
References anum_table, CHashTable::FindFirst(), HF_FIND_END, mudstate, and statedata::vattr_name_htab.
Referenced by dbclean_CheckANHtoAT(), list_vattrs(), and vattr_next().
00679 { 00680 HP_HEAPLENGTH nRecord; 00681 int anum; 00682 HP_DIRINDEX iDir = mudstate.vattr_name_htab.FindFirst(&nRecord, &anum); 00683 if (iDir != HF_FIND_END) 00684 { 00685 return (ATTR *)anum_table[anum]; 00686 } 00687 return NULL; 00688 00689 }
Definition at line 691 of file vattr.cpp.
References anum_table, CHashTable::FindNext(), HF_FIND_END, mudstate, vattr_first(), and statedata::vattr_name_htab.
Referenced by dbclean_CheckANHtoAT(), and list_vattrs().
00692 { 00693 if (vp == NULL) 00694 return vattr_first(); 00695 00696 HP_HEAPLENGTH nRecord; 00697 int anum; 00698 HP_DIRINDEX iDir = mudstate.vattr_name_htab.FindNext(&nRecord, &anum); 00699 if (iDir != HF_FIND_END) 00700 { 00701 return (ATTR *)anum_table[anum]; 00702 } 00703 return NULL; 00704 }
ATTR* vattr_rename_LEN | ( | char * | , | |
int | , | |||
char * | , | |||
int | ||||
) |
Definition at line 648 of file vattr.cpp.
References anum_table, CHashTable::Copy(), CHashTable::FindFirstKey(), CHashTable::FindNextKey(), HASH_ProcessBuffer(), HF_FIND_END, CHashTable::Insert(), mudstate, attr::name, CHashTable::Remove(), store_string(), and statedata::vattr_name_htab.
Referenced by do_attribute().
00649 { 00650 // Find and Delete old name from hashtable. 00651 // 00652 UINT32 nHash = HASH_ProcessBuffer(0, pOldName, nOldName); 00653 CHashTable *pht = &mudstate.vattr_name_htab; 00654 HP_DIRINDEX iDir = pht->FindFirstKey(nHash); 00655 while (iDir != HF_FIND_END) 00656 { 00657 HP_HEAPLENGTH nRecord; 00658 int anum; 00659 pht->Copy(iDir, &nRecord, &anum); 00660 ATTR *vp = (ATTR *)anum_table[anum]; 00661 if (strcmp(pOldName, vp->name) == 0) 00662 { 00663 pht->Remove(iDir); 00664 00665 // Add in new name. After the Insert call, iDir is no longer 00666 // valid, so don't write code that uses it. 00667 // 00668 vp->name = store_string(pNewName); 00669 nHash = HASH_ProcessBuffer(0, pNewName, nNewName); 00670 pht->Insert(sizeof(int), nHash, &anum); 00671 return (ATTR *)anum_table[anum]; 00672 } 00673 iDir = pht->FindNextKey(iDir, nHash); 00674 } 00675 return NULL; 00676 }