]> granicus.if.org Git - postgresql/commitdiff
Silence compiler warnings
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Wed, 28 Sep 2016 22:31:58 +0000 (19:31 -0300)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Wed, 28 Sep 2016 22:31:58 +0000 (19:31 -0300)
Reported by Peter Eisentraut.  Coding suggested by Tom Lane.

src/backend/catalog/objectaddress.c

index 9aa81748ba7a0764ae5eeb2a8c4e831cf0de5660..d531d17cdbcb0c37c4a8c7a0cd992147b877c4f7 100644 (file)
@@ -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 */
 }
 
 /*