diff -r a39557bde4ac -r 5a723cf42aee core/logic/NativeOwner.cpp --- a/core/logic/NativeOwner.cpp Fri Aug 30 10:10:57 2013 -0700 +++ b/core/logic/NativeOwner.cpp Fri Aug 30 10:12:44 2013 -0700 @@ -1,5 +1,5 @@ /** - * vim: set ts=4 : + * vim: set ts=4 sw=4 tw=99 noet : * ============================================================================= * SourcePawn * Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved. @@ -58,17 +58,10 @@ void CNativeOwner::AddNatives(const sp_nativeinfo_t *natives) { - NativeEntry *pEntry; + for (const sp_nativeinfo_t *native = natives; native->func && native->name; native++) + g_ShareSys.AddNativeToCache(this, native); - for (unsigned int i = 0; natives[i].func != NULL && natives[i].name != NULL; i++) - { - if ((pEntry = g_ShareSys.AddNativeToCache(this, &natives[i])) == NULL) - { - continue; - } - - m_Natives.push_back(pEntry); - } + m_natives.append(natives); } void CNativeOwner::PropagateMarkSerial(unsigned int serial) @@ -113,7 +106,6 @@ { NativeEntry *pEntry; List::iterator iter; - List::iterator ntv_iter; /* Unbind and remove all weak references to us */ iter = m_WeakRefs.begin(); @@ -124,7 +116,13 @@ } /* Strip all of our natives from the cache */ - ntv_iter = m_Natives.begin(); + for (size_t i = 0; i < m_natives.length(); i++) { + const sp_nativeinfo_t *natives = m_natives[i]; + for (const sp_nativeinfo_t *native = natives; native->func && native->name; native++) + g_ShareSys.ClearNativeFromCache(this, native->name); + } + + List::iterator ntv_iter = m_Natives.begin(); while (ntv_iter != m_Natives.end()) { g_ShareSys.ClearNativeFromCache(this, (*ntv_iter)->name);