CloseHandle -> delete

This commit is contained in:
neon
2019-07-07 22:44:43 +02:00
parent 537ef8da20
commit 536aa10823
18 changed files with 258 additions and 292 deletions
+15 -17
View File
@@ -270,7 +270,7 @@ stock CAddVariable(String:sName[], String:sValue[], bool:bOnlySaveToConfig = fal
new Handle:hKV = CreateKeyValues("colorvariables");
if (!FileToKeyValues(hKV, g_sConfig)) {
CloseHandle(hKV);
delete hKV;
LogError("Cannot open file (for adding color variable) '%s' !", g_sConfig);
return;
}
@@ -284,13 +284,13 @@ stock CAddVariable(String:sName[], String:sValue[], bool:bOnlySaveToConfig = fal
PushArrayString(hRedirect, sName);
SetTrieString(g_hColors, sName, sValue);
SolveRedirects(g_hColors, hRedirect);
CloseHandle(hRedirect);
delete hRedirect;
}
}
KvRewind(hKV);
KeyValuesToFile(hKV, g_sConfig);
CloseHandle(hKV);
delete hKV;
}
}
@@ -310,7 +310,7 @@ stock CLoadPluginConfig(const String:sPluginName[], bool:bAllowPrefix = true)
new Handle:hRedirect = CreateArray(64);
LoadConfigFile(g_hColors, sConfig, hRedirect, bAllowPrefix);
SolveRedirects(g_hColors, hRedirect);
CloseHandle(hRedirect);
delete hRedirect;
}
}
@@ -346,8 +346,8 @@ stock CLoadPluginVariables(const String:sPluginName[], const String:sVariables[]
}
SolveRedirects(g_hColors, hRedirect);
CloseHandle(hRedirect);
CloseHandle(hVariables);
delete hRedirect;
delete hVariables;
}
}
@@ -571,8 +571,7 @@ stock bool:Init()
}
WriteFileLine(hConfig, "}");
CloseHandle(hConfig);
hConfig = INVALID_HANDLE;
delete hConfig;
} else {
hConfig = OpenFile(g_sConfigGlobal, "r");
if (hConfig == INVALID_HANDLE) {
@@ -582,7 +581,7 @@ stock bool:Init()
new String:sVersionLine[64];
ReadFileLine(hConfig, sVersionLine, sizeof(sVersionLine));
CloseHandle(hConfig);
delete hConfig;
TrimString(sVersionLine);
strcopy(sVersionLine, sizeof(sVersionLine), sVersionLine[FindCharInString(sVersionLine, ':') + 2]);
@@ -591,7 +590,7 @@ stock bool:Init()
new Handle:hKV = CreateKeyValues("colorvariables");
if (!FileToKeyValues(hKV, g_sConfigGlobal) || !KvGotoFirstSubKey(hKV, false)) {
CloseHandle(hKV);
delete hKV;
LogError("Cannot read variables from file '%s' !", g_sConfigGlobal);
return false;
}
@@ -629,8 +628,8 @@ stock bool:Init()
WriteFileLine(hConfig, "}");
CloseHandle(hConfig);
CloseHandle(hKV);
delete hConfig;
delete hKV;
}
}
@@ -643,8 +642,7 @@ stock bool:Init()
}
WriteFileLine(hConfig, "\"colorvariables\"\n{\n}");
CloseHandle(hConfig);
hConfig = INVALID_HANDLE;
delete hConfig;
}
for (new iClient = 1; iClient <= MaxClients; iClient++) {
@@ -683,13 +681,13 @@ stock static LoadConfigFile(Handle:hTrie, String:sPath[], Handle:hRedirect, bool
new Handle:hKV = CreateKeyValues("colorvariables");
if (!FileToKeyValues(hKV, sPath)) {
CloseHandle(hKV);
delete hKV;
LogError("Cannot load color variables from file '%s' !", sPath);
return;
}
if (!KvGotoFirstSubKey(hKV, false)) {
CloseHandle(hKV);
delete hKV;
return;
}
@@ -723,7 +721,7 @@ stock static LoadConfigFile(Handle:hTrie, String:sPath[], Handle:hRedirect, bool
SetTrieString(hTrie, sCode, sColor);
} while (KvGotoNextKey(hKV, false));
CloseHandle(hKV);
delete hKV;
}
stock static SolveRedirects(Handle:hTrie, Handle:hRedirect)