aboutsummaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2022-12-09 10:43:45 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2022-12-09 10:43:45 -0500
commitbad5116957eea2dc360c6c233be08284bd3d5364 (patch)
treec7cf0fd40fd7e37f6e14ed4a9c883a8b129a32a3 /src/backend
parentccff2d20ed9622815df2a7deffce8a7b14830965 (diff)
downloadpostgresql-bad5116957eea2dc360c6c233be08284bd3d5364.tar.gz
postgresql-bad5116957eea2dc360c6c233be08284bd3d5364.zip
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.
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/utils/adt/datetime.c8
-rw-r--r--src/backend/utils/adt/formatting.c6
2 files changed, 7 insertions, 7 deletions
diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c
index 8cd10ab204a..6893c1ce09c 100644
--- a/src/backend/utils/adt/datetime.c
+++ b/src/backend/utils/adt/datetime.c
@@ -3145,7 +3145,7 @@ DecodeNumberField(int len, char *str, int fmask,
* Return 0 if okay (and set *tzp), a DTERR code if not okay.
*/
int
-DecodeTimezone(char *str, int *tzp)
+DecodeTimezone(const char *str, int *tzp)
{
int tz;
int hr,
@@ -3223,7 +3223,7 @@ DecodeTimezone(char *str, int *tzp)
* will be related in format.
*/
int
-DecodeTimezoneAbbrev(int field, char *lowtoken,
+DecodeTimezoneAbbrev(int field, const char *lowtoken,
int *offset, pg_tz **tz)
{
int type;
@@ -3278,7 +3278,7 @@ DecodeTimezoneAbbrev(int field, char *lowtoken,
* will be related in format.
*/
int
-DecodeSpecial(int field, char *lowtoken, int *val)
+DecodeSpecial(int field, const char *lowtoken, int *val)
{
int type;
const datetkn *tp;
@@ -3985,7 +3985,7 @@ DecodeISO8601Interval(char *str,
* will be related in format.
*/
int
-DecodeUnits(int field, char *lowtoken, int *val)
+DecodeUnits(int field, const char *lowtoken, int *val)
{
int type;
const datetkn *tp;
diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c
index 26f498b5df4..311c9e748ba 100644
--- a/src/backend/utils/adt/formatting.c
+++ b/src/backend/utils/adt/formatting.c
@@ -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"));