mirror of
https://github.com/postgres/postgres.git
synced 2025-04-21 12:05:57 +03:00
Fix unreachable code warning from commit 2d819a08a1.
Found by Coverity. Discussion: https://postgr.es/m/3422201.1710711993@sss.pgh.pa.us Reported-by: Tom Lane
This commit is contained in:
parent
5162f663fc
commit
61f352ece9
@ -2501,28 +2501,23 @@ pg_strnxfrm_prefix(char *dest, size_t destsize, const char *src,
|
|||||||
return result;
|
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 *
|
const char *
|
||||||
builtin_validate_locale(int encoding, const char *locale)
|
builtin_validate_locale(int encoding, const char *locale)
|
||||||
{
|
{
|
||||||
const char *canonical_name = NULL;
|
if (strcmp(locale, "C") != 0)
|
||||||
int required_encoding = -1;
|
|
||||||
|
|
||||||
if (strcmp(locale, "C") == 0)
|
|
||||||
canonical_name = "C";
|
|
||||||
|
|
||||||
if (!canonical_name)
|
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
|
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
|
||||||
errmsg("invalid locale name \"%s\" for builtin provider",
|
errmsg("invalid locale name \"%s\" for builtin provider",
|
||||||
locale)));
|
locale)));
|
||||||
|
|
||||||
if (required_encoding >= 0 && encoding != required_encoding)
|
return "C";
|
||||||
ereport(ERROR,
|
|
||||||
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
|
|
||||||
errmsg("encoding \"%s\" does not match locale \"%s\"",
|
|
||||||
pg_encoding_to_char(encoding), locale)));
|
|
||||||
|
|
||||||
return canonical_name;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user