assert that map.insert() is actually doing something in those cases

where I expect it to.
This commit is contained in:
Eric House 2013-01-24 19:34:20 -08:00
parent 036c908b72
commit 7253cfa313
3 changed files with 9 additions and 3 deletions

View file

@ -133,7 +133,9 @@ RelayConfigs::SetValueFor( const char* key, const char* value )
m_values.erase(iter);
}
m_values.insert( pair<const char*,const char*>(strdup(key),strdup(value) ) );
pair<map<const char*,const char*>::iterator,bool> result =
m_values.insert( pair<const char*,const char*>(strdup(key),strdup(value) ) );
assert( result.second );
}
ino_t

View file

@ -462,7 +462,9 @@ CRefMgr::AddNew( const char* cookie, const char* connName, CookieID cid,
ref->assignConnName();
m_cookieMap.insert( pair<CookieID, CookieRef*>(ref->GetCid(), ref ) );
pair<CookieMap::iterator,bool> result =
m_cookieMap.insert( pair<CookieID, CookieRef*>(ref->GetCid(), ref ) );
assert( result.second );
logf( XW_LOGINFO, "%s: paired cookie %s/connName %s with cid %d", __func__,
(cookie?cookie:"NULL"), connName, ref->GetCid() );

View file

@ -171,7 +171,9 @@ ListenerMgr::addOne( int port, bool perGame )
success = sock != -1;
if ( success ) {
pair<int,bool>entry(port, perGame);
m_socks_to_ports.insert( pair<int,pair<int,bool> >(sock, entry ) );
pair<map<int,pair<int,bool> >::iterator, bool> result
= m_socks_to_ports.insert( pair<int,pair<int,bool> >(sock, entry ) );
assert( result.second );
}
return success;
}