From: Alvaro Herrera Date: Wed, 28 Sep 2016 22:31:58 +0000 (-0300) Subject: Silence compiler warnings X-Git-Tag: REL9_6_1~61 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7341c2830cf3d06a96d97f0e6a2e85bf808faae4;p=postgresql Silence compiler warnings Reported by Peter Eisentraut. Coding suggested by Tom Lane. --- diff --git a/src/backend/catalog/objectaddress.c b/src/backend/catalog/objectaddress.c index 9aa81748ba..d531d17cdb 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 */ } /*