fixed some compiler warnings and leaks

This commit is contained in:
Ken Martin 2002-08-07 10:30:38 -04:00
parent 559d99e97d
commit 3704cc268e

View File

@ -194,7 +194,7 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& argsIn)
" p = new_string;\n" " p = new_string;\n"
" while (*p != 0)\n" " while (*p != 0)\n"
" {\n" " {\n"
" *p = tolower(*p);\n" " *p = (char)tolower(*p);\n"
" ++p;\n" " ++p;\n"
" }\n" " }\n"
" return new_string;\n" " return new_string;\n"
@ -202,7 +202,7 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& argsIn)
"\n" "\n"
"int main(int ac, char *av[])\n" "int main(int ac, char *av[])\n"
"{\n" "{\n"
" int NumTests, i, testNum, partial_match;\n" " int i, testNum, partial_match;\n"
" char *arg, *test_name;\n" " char *arg, *test_name;\n"
" \n" " \n"
" NumTests = " << numTests << ";\n" " NumTests = " << numTests << ";\n"
@ -217,12 +217,6 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& argsIn)
fout << fout <<
" if (ac < 2)\n" " if (ac < 2)\n"
" {\n" " {\n"
" // If there is only one test, then run it with the arguments\n"
" if (NumTests == 1)\n"
" {\n"
" return (*cmakeGeneratedFunctionMapEntries[0].func)(ac, av);\n"
" }\n"
" \n"
" // Ask for a test\n" " // Ask for a test\n"
" printf(\"Available tests:\\n\");\n" " printf(\"Available tests:\\n\");\n"
" for (i =0; i < NumTests; ++i)\n" " for (i =0; i < NumTests; ++i)\n"
@ -254,23 +248,18 @@ bool cmCreateTestSourceList::InitialPass(std::vector<std::string> const& argsIn)
" test_name = lowercase(cmakeGeneratedFunctionMapEntries[i].name);\n" " test_name = lowercase(cmakeGeneratedFunctionMapEntries[i].name);\n"
" if (partial_match && strstr(test_name, arg) != NULL)\n" " if (partial_match && strstr(test_name, arg) != NULL)\n"
" {\n" " {\n"
" free(test_name);\n"
" return (*cmakeGeneratedFunctionMapEntries[i].func)(ac - 2, av + 2);\n" " return (*cmakeGeneratedFunctionMapEntries[i].func)(ac - 2, av + 2);\n"
" }\n" " }\n"
" else if (!partial_match && strcmp(test_name, arg) == 0)\n" " else if (!partial_match && strcmp(test_name, arg) == 0)\n"
" {\n" " {\n"
" free(test_name);\n"
" return (*cmakeGeneratedFunctionMapEntries[i].func)(ac - 1, av + 1);\n" " return (*cmakeGeneratedFunctionMapEntries[i].func)(ac - 1, av + 1);\n"
" }\n" " }\n"
" free(test_name);\n" " free(test_name);\n"
" }\n" " }\n"
" free(arg);\n" " free(arg);\n"
" \n" " \n"
" // If the test was not found but there is only one test, then\n"
" // run it with the arguments\n"
" if (NumTests == 1)\n"
" {\n"
" return (*cmakeGeneratedFunctionMapEntries[0].func)(ac, av);\n"
" }\n"
" \n"
" // Nothing was run, display the test names\n" " // Nothing was run, display the test names\n"
" printf(\"Available tests:\\n\");\n" " printf(\"Available tests:\\n\");\n"
" for (i =0; i < NumTests; ++i)\n" " for (i =0; i < NumTests; ++i)\n"