Suppress compiler warning for get_am_type_string().
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 24 Mar 2016 21:22:24 +0000 (17:22 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 24 Mar 2016 21:22:24 +0000 (17:22 -0400)
Compilers that don't know that elog(ERROR) doesn't return complained
that this function might fail to return a value.  Per buildfarm.

While at it, const-ify the function's declaration, since the intent
is evidently to always return a constant string.

src/backend/commands/amcmds.c

index 7a937543916e2747fe4fe36494c5183767d768e9..68ea5f3c58326f47efc08fea76b845132d7cb588 100644 (file)
@@ -30,7 +30,7 @@
 
 
 static Oid lookup_index_am_handler_func(List *handler_name, char amtype);
-static char *get_am_type_string(char amtype);
+static const char *get_am_type_string(char amtype);
 
 
 /*
@@ -217,9 +217,9 @@ get_am_name(Oid amOid)
 }
 
 /*
- * Convert single charater access method type into string for error reporting.
+ * Convert single-character access method type into string for error reporting.
  */
-static char *
+static const char *
 get_am_type_string(char amtype)
 {
    switch (amtype)
@@ -229,6 +229,7 @@ get_am_type_string(char amtype)
        default:
            /* shouldn't happen */
            elog(ERROR, "invalid access method type '%c'", amtype);
+           return NULL;        /* keep compiler quiet */
    }
 }