Hello.
Please, take a look at this patch. There are several local variables, that obviously may be removed.

--
Dmitriy Olshevskiy

>From 604e073384e6812f6c26a301e323ffe42ab23a62 Mon Sep 17 00:00:00 2001
From: olshevskiy87 <[email protected]>
Date: Wed, 20 May 2015 23:18:54 +0400
Subject: [PATCH] remove redundant local variables

---
 pgadmin/ctl/ctlSQLResult.cpp       | 3 +--
 pgadmin/dlg/dlgColumn.cpp          | 2 +-
 pgadmin/dlg/dlgForeignTable.cpp    | 2 --
 pgadmin/dlg/dlgIndex.cpp           | 3 +--
 pgadmin/dlg/dlgIndexConstraint.cpp | 2 +-
 pgadmin/dlg/dlgManageMacros.cpp    | 1 -
 pgadmin/dlg/dlgMoveTablespace.cpp  | 2 --
 pgadmin/dlg/dlgRule.cpp            | 1 -
 pgadmin/dlg/dlgSearchObject.cpp    | 1 -
 pgadmin/dlg/dlgServer.cpp          | 1 -
 pgadmin/dlg/dlgTablespace.cpp      | 2 --
 pgadmin/dlg/dlgType.cpp            | 2 --
 pgadmin/schema/pgServer.cpp        | 3 +--
 pgadmin/schema/pgTable.cpp         | 1 -
 pgadmin/schema/pgTablespace.cpp    | 2 --
 pgadmin/schema/pgType.cpp          | 4 ----
 16 files changed, 5 insertions(+), 27 deletions(-)

diff --git a/pgadmin/ctl/ctlSQLResult.cpp b/pgadmin/ctl/ctlSQLResult.cpp
index 1467569..12f71ae 100644
--- a/pgadmin/ctl/ctlSQLResult.cpp
+++ b/pgadmin/ctl/ctlSQLResult.cpp
@@ -325,8 +325,7 @@ wxString sqlResultTable::GetValue(int row, int col)
 			{
 
 				wxString decimalMark = wxT(".");
-				wxString s = wxEmptyString;
-				s = thread->DataSet()->GetVal(col);
+				wxString s = thread->DataSet()->GetVal(col);
 
 				if(thread->DataSet()->ColTypClass(col) == PGTYPCLASS_NUMERIC &&
 				        settings->GetDecimalMark().Length() > 0)
diff --git a/pgadmin/dlg/dlgColumn.cpp b/pgadmin/dlg/dlgColumn.cpp
index fb6f9e9..616cd38 100644
--- a/pgadmin/dlg/dlgColumn.cpp
+++ b/pgadmin/dlg/dlgColumn.cpp
@@ -738,7 +738,7 @@ void dlgColumn::GetSecLabelList(wxArrayString &secLabelList)
 
 wxString dlgColumn::GetDefinition()
 {
-	wxString sql, col;
+	wxString sql;
 	sql = GetQuotedTypename(cbDatatype->GetGuessedSelection());
 	if (!cbCollation->GetValue().IsEmpty() && cbCollation->GetValue() != wxT("pg_catalog.\"default\""))
 		sql += wxT(" COLLATE ") + cbCollation->GetValue();
diff --git a/pgadmin/dlg/dlgForeignTable.cpp b/pgadmin/dlg/dlgForeignTable.cpp
index f9d9f24..1752039 100644
--- a/pgadmin/dlg/dlgForeignTable.cpp
+++ b/pgadmin/dlg/dlgForeignTable.cpp
@@ -379,8 +379,6 @@ void dlgForeignTable::OnMemberRemove(wxCommandEvent &ev)
 
 pgObject *dlgForeignTable::CreateObject(pgCollection *collection)
 {
-	wxString name = GetName();
-
 	pgObject *obj = 0;
 	return obj;
 }
diff --git a/pgadmin/dlg/dlgIndex.cpp b/pgadmin/dlg/dlgIndex.cpp
index 3a54c73..d9a11f7 100644
--- a/pgadmin/dlg/dlgIndex.cpp
+++ b/pgadmin/dlg/dlgIndex.cpp
@@ -344,8 +344,7 @@ int dlgIndex::Go(bool modal)
 		// on PostgreSQL 8.3+, for btree indexes.
 		wxArrayString colsArr = index->GetColumnList();
 		wxArrayString collationsArray = index->GetCollationsArray();
-		wxString colDef, colRest, colName, descDef, nullsDef, opclassDef, collation;
-		const wxString firstOrder = wxT(" NULLS FIRST"), lastOrder = wxT(" NULLS LAST"), descOrder = wxT(" DESC");
+		wxString colDef, descDef, nullsDef, opclassDef;
 		if (this->database->BackendMinimumVersion(8, 3) && index->GetIndexType() == wxT("btree"))
 		{
 			for (unsigned int colIdx = 0, colsCount = colsArr.Count(); colIdx < colsCount; colIdx++)
diff --git a/pgadmin/dlg/dlgIndexConstraint.cpp b/pgadmin/dlg/dlgIndexConstraint.cpp
index 59c4ea5..6be1c55 100644
--- a/pgadmin/dlg/dlgIndexConstraint.cpp
+++ b/pgadmin/dlg/dlgIndexConstraint.cpp
@@ -133,7 +133,7 @@ int dlgIndexConstraint::Go(bool modal)
 		// We only display the column options (ASC/DESC, NULLS FIRST/LAST)
 		// on exclude constraints with btree
 		wxArrayString colsArr = index->GetColumnList();
-		wxString colDef, colRest, colName, descDef, nullsDef, opclassDef, withDef;
+		wxString colDef, colRest, descDef, nullsDef, opclassDef, withDef;
 		const wxString firstOrder = wxT(" NULLS FIRST"), lastOrder = wxT(" NULLS LAST");
 		const wxString descOrder = wxT(" DESC");
 		if (wxString(factory->GetTypeName()).Upper() == wxT("EXCLUDE") && index->GetIndexType() == wxT("btree"))
diff --git a/pgadmin/dlg/dlgManageMacros.cpp b/pgadmin/dlg/dlgManageMacros.cpp
index c1d27d4..3621988 100644
--- a/pgadmin/dlg/dlgManageMacros.cpp
+++ b/pgadmin/dlg/dlgManageMacros.cpp
@@ -139,7 +139,6 @@ void dlgManageMacros::DeleteMacro(int listItem)
 void dlgManageMacros::OnClear(wxCommandEvent &ev)
 {
 	int item;
-	wxString key;
 	item = lstKeys->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
 
 	if (item == -1)
diff --git a/pgadmin/dlg/dlgMoveTablespace.cpp b/pgadmin/dlg/dlgMoveTablespace.cpp
index 7c0cf40..e783915 100644
--- a/pgadmin/dlg/dlgMoveTablespace.cpp
+++ b/pgadmin/dlg/dlgMoveTablespace.cpp
@@ -100,8 +100,6 @@ wxString dlgMoveTablespace::GetTablespace()
 
 wxString dlgMoveTablespace::GetKind()
 {
-	wxString kind;
-
 	if (cbKind->GetValue().Cmp(_("Tables")) == 0)
 		return wxT("TABLES");
 	if (cbKind->GetValue().Cmp(_("Indexes")) == 0)
diff --git a/pgadmin/dlg/dlgRule.cpp b/pgadmin/dlg/dlgRule.cpp
index 72309f3..c66c2b1 100644
--- a/pgadmin/dlg/dlgRule.cpp
+++ b/pgadmin/dlg/dlgRule.cpp
@@ -141,7 +141,6 @@ bool dlgRule::didChange()
 
 void dlgRule::CheckChange()
 {
-	wxString name = GetName();
 	if (rule)
 	{
 		EnableOK(didChange() || txtSqlBox->GetText() != oldDefinition || txtComment->GetValue() != rule->GetComment());
diff --git a/pgadmin/dlg/dlgSearchObject.cpp b/pgadmin/dlg/dlgSearchObject.cpp
index a933ac3..dbad148 100644
--- a/pgadmin/dlg/dlgSearchObject.cpp
+++ b/pgadmin/dlg/dlgSearchObject.cpp
@@ -854,7 +854,6 @@ void dlgSearchObject::OnSearch(wxCommandEvent &ev)
 			if(objectType == wxT("Login Roles") || objectType == wxT("Group Roles") || objectType == wxT("Tablespaces"))
 			{
 				wxStringTokenizer tkz(databasePath, wxT("/"));
-				wxString newPath;
 				while(tkz.HasMoreTokens())
 				{
 					wxString token = tkz.GetNextToken();
diff --git a/pgadmin/dlg/dlgServer.cpp b/pgadmin/dlg/dlgServer.cpp
index c6f51ea..5f63405 100644
--- a/pgadmin/dlg/dlgServer.cpp
+++ b/pgadmin/dlg/dlgServer.cpp
@@ -570,7 +570,6 @@ wxString dlgServer::GetPassword()
 
 pgObject *dlgServer::CreateObject(pgCollection *collection)
 {
-	wxString name = GetName();
 	pgServer *obj = NULL;
 
 #if defined(HAVE_OPENSSL_CRYPTO) || defined(HAVE_GCRYPT)
diff --git a/pgadmin/dlg/dlgTablespace.cpp b/pgadmin/dlg/dlgTablespace.cpp
index 679a63d..0061346 100644
--- a/pgadmin/dlg/dlgTablespace.cpp
+++ b/pgadmin/dlg/dlgTablespace.cpp
@@ -171,8 +171,6 @@ void dlgTablespace::CheckChange()
 	}
 	else
 	{
-		wxString name = GetName();
-
 		CheckValid(enable, !GetName().IsEmpty(), _("Please specify name."));
 		CheckValid(enable, !txtLocation->GetValue().IsEmpty(), _("Please specify location."));
 	}
diff --git a/pgadmin/dlg/dlgType.cpp b/pgadmin/dlg/dlgType.cpp
index c71a019..256a0de 100644
--- a/pgadmin/dlg/dlgType.cpp
+++ b/pgadmin/dlg/dlgType.cpp
@@ -1007,8 +1007,6 @@ void dlgType::OnLabelRemove(wxCommandEvent &ev)
 
 pgObject *dlgType::CreateObject(pgCollection *collection)
 {
-	wxString name = GetName();
-
 	pgObject *obj = 0; //pgType::ReadObjects(collection, 0, wxT("\n WHERE usename=") + qtDbString(name));
 	return obj;
 }
diff --git a/pgadmin/schema/pgServer.cpp b/pgadmin/schema/pgServer.cpp
index caba8b1..6dc1f1d 100644
--- a/pgadmin/schema/pgServer.cpp
+++ b/pgadmin/schema/pgServer.cpp
@@ -1550,7 +1550,6 @@ pgObject *pgServerFactory::CreateObjects(pgCollection *obj, ctlTree *browser, co
 		if (!colour.IsEmpty())
 		{
 			wxColour cColour;
-			wxString sColour = wxEmptyString;
 
 			if (cColour.Set(colour))
 				colour = cColour.GetAsString(wxC2S_HTML_SYNTAX);
@@ -1649,7 +1648,7 @@ pgObject *pgServerFactory::CreateObjects(pgCollection *obj, ctlTree *browser, co
 	while (pgKey != NULL)
 	{
 		pgRegKey *svcKey = NULL;
-		wxString svcName, temp;
+		wxString svcName;
 		long cookie = 0;
 		DWORD tmpport = 0;
 		bool flag = false;
diff --git a/pgadmin/schema/pgTable.cpp b/pgadmin/schema/pgTable.cpp
index c0e2d26..e6f579e 100644
--- a/pgadmin/schema/pgTable.cpp
+++ b/pgadmin/schema/pgTable.cpp
@@ -843,7 +843,6 @@ wxString pgTable::GetUpdateSql(ctlTree *browser)
 
 wxString pgTable::GetDeleteSql(ctlTree *browser)
 {
-	wxString qms;
 	wxString sql =
 	    wxT("DELETE FROM ") + GetQuotedFullIdentifier() + wxT("\n")
 	    wxT(" WHERE <condition>;\n");
diff --git a/pgadmin/schema/pgTablespace.cpp b/pgadmin/schema/pgTablespace.cpp
index 991f83e..98a5cd3 100644
--- a/pgadmin/schema/pgTablespace.cpp
+++ b/pgadmin/schema/pgTablespace.cpp
@@ -283,8 +283,6 @@ pgObject *pgTablespaceFactory::CreateObjects(pgCollection *collection, ctlTree *
 {
 	pgTablespace *tablespace = 0;
 
-	wxString tabname;
-
 	pgSet *tablespaces;
 	if (collection->GetConnection()->BackendMinimumVersion(9, 2))
 		tablespaces = collection->GetServer()->ExecuteSet(
diff --git a/pgadmin/schema/pgType.cpp b/pgadmin/schema/pgType.cpp
index d24a577..9c72d4f 100644
--- a/pgadmin/schema/pgType.cpp
+++ b/pgadmin/schema/pgType.cpp
@@ -220,7 +220,6 @@ void pgType::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *proper
 				int anzvar = 0;
 				while (!set->Eof())
 				{
-					wxString element;
 					if (anzvar++)
 					{
 						typesList += wxT(", ");
@@ -233,8 +232,6 @@ void pgType::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *proper
 					pgDatatype dt(set->GetVal(wxT("nspname")), set->GetVal(wxT("typname")),
 					              set->GetBool(wxT("isdup")), set->GetLong(wxT("attndims")) > 0, set->GetLong(wxT("atttypmod")));
 
-					wxString nspname = set->GetVal(wxT("nspname"));
-
 					typesList += dt.GetSchemaPrefix(GetDatabase()) + dt.FullName();
 					typesArray.Add(dt.GetSchemaPrefix(GetDatabase()) + dt.FullName());
 					quotedTypesList += dt.GetQuotedSchemaPrefix(GetDatabase()) + dt.QuotedFullName();
@@ -272,7 +269,6 @@ void pgType::ShowTreeDetail(ctlTree *browser, frmMain *form, ctlListView *proper
 				int anzvar = 0;
 				while (!set->Eof())
 				{
-					wxString element;
 					if (anzvar++)
 					{
 						labelList += wxT(", ");
-- 
1.8.3.msysgit.0

-- 
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers

Reply via email to