From: Alvaro Herrera Date: Wed, 28 Sep 2016 22:31:58 +0000 (-0300) Subject: Silence compiler warnings X-Git-Tag: REL9_5_5~45 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2937ffa5d5790e6bcefae0492388adb192db936b;p=thirdparty%2Fpostgresql.git 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 e44d7d09e16..179bf125c52 100644 --- a/src/backend/catalog/objectaddress.c +++ b/src/backend/catalog/objectaddress.c @@ -2237,23 +2237,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 */ } /*