From b82d5a2c7c9dd1a01041feef2834db27a46fb2d3 Mon Sep 17 00:00:00 2001
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
Date: Wed, 28 Sep 2016 19:31:58 -0300
Subject: [PATCH] Silence compiler warnings

Reported by Peter Eisentraut.  Coding suggested by Tom Lane.
---
 src/backend/catalog/objectaddress.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/src/backend/catalog/objectaddress.c b/src/backend/catalog/objectaddress.c
index 9aa81748ba7..d531d17cdbc 100644
--- a/src/backend/catalog/objectaddress.c
+++ b/src/backend/catalog/objectaddress.c
@@ -2290,23 +2290,18 @@ get_object_namespace(const ObjectAddress *address)
 int
 read_objtype_from_string(const char *objtype)
 {
-	ObjectType	type;
 	int			i;
 
 	for (i = 0; i < lengthof(ObjectTypeMap); i++)
 	{
 		if (strcmp(ObjectTypeMap[i].tm_name, objtype) == 0)
-		{
-			type = ObjectTypeMap[i].tm_type;
-			break;
-		}
+			return ObjectTypeMap[i].tm_type;
 	}
-	if (i >= lengthof(ObjectTypeMap))
-		ereport(ERROR,
-				(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-				 errmsg("unrecognized object type \"%s\"", objtype)));
+	ereport(ERROR,
+			(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+			 errmsg("unrecognized object type \"%s\"", objtype)));
 
-	return type;
+	return -1;					/* keep compiler quiet */
 }
 
 /*
-- 
GitLab