Skip to content

Commit 61f352e

Browse files
committed
Fix unreachable code warning from commit 2d819a0.
Found by Coverity. Discussion: https://postgr.es/m/3422201.1710711993@sss.pgh.pa.us Reported-by: Tom Lane
1 parent 5162f66 commit 61f352e

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

src/backend/utils/adt/pg_locale.c

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2501,28 +2501,23 @@ pg_strnxfrm_prefix(char *dest, size_t destsize, const char *src,
25012501
return result;
25022502
}
25032503

2504+
/*
2505+
* Validate the locale and encoding combination, and return the canonical form
2506+
* of the locale name.
2507+
*
2508+
* The only supported locale for the builtin provider is "C", and it's
2509+
* available for any encoding.
2510+
*/
25042511
const char *
25052512
builtin_validate_locale(int encoding, const char *locale)
25062513
{
2507-
const char *canonical_name = NULL;
2508-
int required_encoding = -1;
2509-
2510-
if (strcmp(locale, "C") == 0)
2511-
canonical_name = "C";
2512-
2513-
if (!canonical_name)
2514+
if (strcmp(locale, "C") != 0)
25142515
ereport(ERROR,
25152516
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
25162517
errmsg("invalid locale name \"%s\" for builtin provider",
25172518
locale)));
25182519

2519-
if (required_encoding >= 0 && encoding != required_encoding)
2520-
ereport(ERROR,
2521-
(errcode(ERRCODE_WRONG_OBJECT_TYPE),
2522-
errmsg("encoding \"%s\" does not match locale \"%s\"",
2523-
pg_encoding_to_char(encoding), locale)));
2524-
2525-
return canonical_name;
2520+
return "C";
25262521
}
25272522

25282523

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy