/** * Calculates the size of the given property directory AVL list. This * will iterate over the entire structure to give the entire size. It * is the low level equivalent of size_properties * * @see size_properties * * @param avl the Property directory AVL to check * @return the size of the loaded properties in memory -- this does NOT * do any diskbase loading. */ size_t size_proplist(PropPtr avl) { size_t bytes = 0; if (!avl) return 0; bytes += sizeof(struct plist); bytes += strlen(PropName(avl)); if (!(PropFlags(avl) & PROP_ISUNLOADED)) { switch (PropType(avl)) { case PROP_STRTYP: bytes += strlen(PropDataStr(avl)) + 1; break; case PROP_LOKTYP: bytes += size_boolexp(PropDataLok(avl)); break; default: break; } } bytes += size_proplist(avl->left); bytes += size_proplist(avl->right); bytes += size_proplist(PropDir(avl)); return bytes; }
int size_properties(dbref player, int load) { #ifdef DISKBASE if (load) { fetchprops(player); fetch_propvals(player, "/"); } #endif return size_proplist(DBFETCH(player)->properties); }