@@ -172,8 +172,8 @@ int CFunctions::amxLoad(lua_State *luaVM) {
172172 amx_TimeInit (amx);
173173 amx_FileInit (amx);
174174 err = amx_SAMPInit (amx);
175- for (map< string, SampPlugin* >::iterator it = loadedPlugins. begin (); it != loadedPlugins. end (); it++ ) {
176- AmxLoad_t* pfnAmxLoad = it-> second ->AmxLoad ;
175+ for ( const auto & plugin : loadedPlugins) {
176+ AmxLoad_t* pfnAmxLoad = plugin. second ->AmxLoad ;
177177 if (pfnAmxLoad) {
178178 err = pfnAmxLoad (amx);
179179 }
@@ -206,7 +206,7 @@ int CFunctions::amxLoad(lua_State *luaVM) {
206206 lua_getfield (luaVM, LUA_REGISTRYINDEX, " amx" );
207207 lua_getfield (luaVM, -1 , resName);
208208 if (lua_isnil (luaVM, -1 )) {
209- lua_newtable (luaVM);
209+ lua_newtable (luaVM);
210210 lua_setfield (luaVM, -3 , resName);
211211 }
212212
@@ -278,8 +278,8 @@ int CFunctions::amxCall(lua_State *luaVM) {
278278 cell ret;
279279 int err = amx_Exec (amx, &ret, fnIndex);
280280 // Release string arguments
281- for (vector<cell>::iterator it = stringsToRelease. begin (); it != stringsToRelease. end (); it++ ) {
282- amx_Release (amx, *it );
281+ for ( const auto & amxStringAddr : stringsToRelease ) {
282+ amx_Release (amx, amxStringAddr );
283283 }
284284 if (err != AMX_ERR_NONE) {
285285 if (err == AMX_ERR_SLEEP)
@@ -365,16 +365,16 @@ int CFunctions::amxUnload(lua_State *luaVM) {
365365 return 1 ;
366366 }
367367 // Call all plugins' AmxUnload function
368- for (map< string, SampPlugin* >::iterator piIt = loadedPlugins. begin (); piIt != loadedPlugins. end (); piIt++ ) {
369- AmxUnload_t *pfnAmxUnload = piIt-> second ->AmxUnload ;
368+ for ( const auto & plugin : loadedPlugins) {
369+ AmxUnload_t *pfnAmxUnload = plugin. second ->AmxUnload ;
370370 if (pfnAmxUnload) {
371371 pfnAmxUnload (amx);
372372 }
373373 }
374374 // Close any open databases
375375 if (loadedDBs.find (amx) != loadedDBs.end ()) {
376- for (map< int , sqlite3 * >::iterator dbIt = loadedDBs[amx]. begin (); dbIt != loadedDBs[amx]. end (); dbIt++ )
377- sqlite3_close (dbIt-> second );
376+ for ( const auto & db : loadedDBs[amx])
377+ sqlite3_close (db. second );
378378 loadedDBs.erase (amx);
379379 }
380380 // Unload
@@ -390,10 +390,10 @@ int CFunctions::amxUnload(lua_State *luaVM) {
390390
391391// amxUnloadAllPlugins()
392392int CFunctions::amxUnloadAllPlugins (lua_State *luaVM) {
393- for (map< string, SampPlugin* >::iterator it = loadedPlugins. begin (); it != loadedPlugins. end (); it++ ) {
394- it-> second ->Unload ();
395- freeLib (it-> second ->pPluginPointer );
396- delete it-> second ;
393+ for (const auto & plugin : loadedPlugins) {
394+ plugin. second ->Unload ();
395+ freeLib (plugin. second ->pPluginPointer );
396+ delete plugin. second ;
397397 }
398398 loadedPlugins.clear ();
399399 vecPfnProcessTick.clear ();
@@ -477,9 +477,9 @@ int CFunctions::pawn(lua_State *luaVM) {
477477
478478 int fnIndex;
479479 AMX *amx = NULL ;
480- for (vector<AMX *>::iterator it = amxs. begin (); it != amxs. end (); it++ ) {
481- if (amx_FindPublic (* it, fnName, &fnIndex) == AMX_ERR_NONE) {
482- amx = * it;
480+ for ( const auto & it : amxs) {
481+ if (amx_FindPublic (it, fnName, &fnIndex) == AMX_ERR_NONE) {
482+ amx = it;
483483 break ;
484484 }
485485 }
0 commit comments