git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5162f66)
Fix unreachable code warning from commit 2d819a08a1.
2024年3月18日 16:15:47 +0000 (09:15 -0700)
2024年3月18日 16:15:47 +0000 (09:15 -0700)
Found by Coverity.

Discussion: https://postgr.es/m/3422201.1710711993@sss.pgh.pa.us
Reported-by: Tom Lane

diff --git a/src/backend/utils/adt/pg_locale.c b/src/backend/utils/adt/pg_locale.c
index 39390fbe4eb23a525a0103dcac4413949c1dce98..364716bcec8692db16908f1987c971d58ec7c962 100644 (file)
--- a/src/backend/utils/adt/pg_locale.c
+++ b/src/backend/utils/adt/pg_locale.c
@@ -2501,28 +2501,23 @@ pg_strnxfrm_prefix(char *dest, size_t destsize, const char *src,
return result;
}
+/*
+ * Validate the locale and encoding combination, and return the canonical form
+ * of the locale name.
+ *
+ * The only supported locale for the builtin provider is "C", and it's
+ * available for any encoding.
+ */
const char *
builtin_validate_locale(int encoding, const char *locale)
{
- const char *canonical_name = NULL;
- int required_encoding = -1;
-
- if (strcmp(locale, "C") == 0)
- canonical_name = "C";
-
- if (!canonical_name)
+ if (strcmp(locale, "C") != 0)
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("invalid locale name \"%s\" for builtin provider",
locale)));
- if (required_encoding >= 0 && encoding != required_encoding)
- ereport(ERROR,
- (errcode(ERRCODE_WRONG_OBJECT_TYPE),
- errmsg("encoding \"%s\" does not match locale \"%s\"",
- pg_encoding_to_char(encoding), locale)));
-
- return canonical_name;
+ return "C";
}
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /