1.1 --- a/core/logic/NativeOwner.cpp Fri Aug 30 10:10:57 2013 -0700
1.2 +++ b/core/logic/NativeOwner.cpp Fri Aug 30 10:12:44 2013 -0700
1.3 @@ -1,5 +1,5 @@
1.4 /**
1.5 - * vim: set ts=4 :
1.6 + * vim: set ts=4 sw=4 tw=99 noet :
1.7 * =============================================================================
1.8 * SourcePawn
1.9 * Copyright (C) 2004-2009 AlliedModders LLC. All rights reserved.
1.10 @@ -58,17 +58,10 @@
1.11
1.12 void CNativeOwner::AddNatives(const sp_nativeinfo_t *natives)
1.13 {
1.14 - NativeEntry *pEntry;
1.15 + for (const sp_nativeinfo_t *native = natives; native->func && native->name; native++)
1.16 + g_ShareSys.AddNativeToCache(this, native);
1.17
1.18 - for (unsigned int i = 0; natives[i].func != NULL && natives[i].name != NULL; i++)
1.19 - {
1.20 - if ((pEntry = g_ShareSys.AddNativeToCache(this, &natives[i])) == NULL)
1.21 - {
1.22 - continue;
1.23 - }
1.24 -
1.25 - m_Natives.push_back(pEntry);
1.26 - }
1.27 + m_natives.append(natives);
1.28 }
1.29
1.30 void CNativeOwner::PropagateMarkSerial(unsigned int serial)
1.31 @@ -113,7 +106,6 @@
1.32 {
1.33 NativeEntry *pEntry;
1.34 List<WeakNative>::iterator iter;
1.35 - List<NativeEntry *>::iterator ntv_iter;
1.36
1.37 /* Unbind and remove all weak references to us */
1.38 iter = m_WeakRefs.begin();
1.39 @@ -124,7 +116,13 @@
1.40 }
1.41
1.42 /* Strip all of our natives from the cache */
1.43 - ntv_iter = m_Natives.begin();
1.44 + for (size_t i = 0; i < m_natives.length(); i++) {
1.45 + const sp_nativeinfo_t *natives = m_natives[i];
1.46 + for (const sp_nativeinfo_t *native = natives; native->func && native->name; native++)
1.47 + g_ShareSys.ClearNativeFromCache(this, native->name);
1.48 + }
1.49 +
1.50 + List<NativeEntry *>::iterator ntv_iter = m_Natives.begin();
1.51 while (ntv_iter != m_Natives.end())
1.52 {
1.53 g_ShareSys.ClearNativeFromCache(this, (*ntv_iter)->name);