Show
Ignore:
Timestamp:
07/01/08 02:41:30 (5 months ago)
Author:
flynd
Message:

Replaced CUserHashTable with std::map. A custom hash map shouldn't make any significant improvement with the number of items in a normal contact list so better and easier to use a std class instead. Also added some missing mutex locks on the user list.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/licq/include/licq_user.h

    r6362 r6363  
    234234class LicqGroup; 
    235235 
     236typedef std::pair<std::string, unsigned long> UserMapKey; 
     237typedef std::map<UserMapKey, class ICQUser*> UserMap; 
    236238typedef std::list<ICQUser *> UserList; 
    237239typedef std::list<class ICQOwner *> OwnerList; 
     
    11521154}; 
    11531155 
    1154  
    1155 //=====CUsers=================================================================== 
    1156  
    1157 class CUserHashTable 
    1158 { 
    1159 public: 
    1160   CUserHashTable(unsigned short _nSize); 
    1161   ~CUserHashTable(); 
    1162  
    1163   // For protocol plugins 
    1164   ICQUser *Retrieve(const char *, unsigned long); 
    1165   void Store(ICQUser *, const char *, unsigned long); 
    1166   void Remove(const char *, unsigned long); 
    1167  
    1168 protected: 
    1169   // For protocol plugin 
    1170   unsigned short HashValue(const char *); 
    1171  
    1172   void Lock(unsigned short _nLockType); 
    1173   void Unlock(); 
    1174  
    1175   std::vector < UserList > m_vlTable; 
    1176  
    1177   pthread_rdwr_t mutex_rw; 
    1178   unsigned short m_nLockType; 
    1179 }; 
    1180  
    11811156/** 
    11821157 * Class holding data for a user group in the contact list. 
     
    15121487  GroupMap myGroups; 
    15131488  UserList m_vpcUsers; 
     1489  UserMap myUsers; 
    15141490  OwnerList m_vpcOwners; 
    1515   CUserHashTable m_hUsers; 
    15161491  ICQOwner *m_xOwner; 
    15171492  unsigned long m_nOwnerUin;