1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-19 13:42:17 +03:00

Const-ify a couple of datetime parsing subroutines.

More could be done in this line, but I just grabbed some low-hanging
fruit.  Principal objective was to remove the need for several ugly
unconstify() usages in formatting.c.
This commit is contained in:
Tom Lane
2022-12-09 10:43:45 -05:00
parent ccff2d20ed
commit bad5116957
3 changed files with 11 additions and 11 deletions

View File

@@ -4246,7 +4246,7 @@ to_timestamp(PG_FUNCTION_ARGS)
/* Use the specified time zone, if any. */
if (tm.tm_zone)
{
int dterr = DecodeTimezone(unconstify(char *, tm.tm_zone), &tz);
int dterr = DecodeTimezone(tm.tm_zone, &tz);
if (dterr)
DateTimeParseError(dterr, text_to_cstring(date_txt), "timestamptz");
@@ -4343,7 +4343,7 @@ parse_datetime(text *date_txt, text *fmt, Oid collid, bool strict,
if (tm.tm_zone)
{
int dterr = DecodeTimezone(unconstify(char *, tm.tm_zone), tz);
int dterr = DecodeTimezone(tm.tm_zone, tz);
if (dterr)
DateTimeParseError(dterr, text_to_cstring(date_txt), "timestamptz");
@@ -4429,7 +4429,7 @@ parse_datetime(text *date_txt, text *fmt, Oid collid, bool strict,
if (tm.tm_zone)
{
int dterr = DecodeTimezone(unconstify(char *, tm.tm_zone), tz);
int dterr = DecodeTimezone(tm.tm_zone, tz);
if (dterr)
RETURN_ERROR(DateTimeParseError(dterr, text_to_cstring(date_txt), "timetz"));