Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commiteb990a2

Browse files
committed
Add const qualifier to tzn returned by timestamp2tm()
The tzn value might come from tm->tm_zone, which libc declares asconst, so it's prudent that the upper layers know about this as well.
1 parent531e60a commiteb990a2

File tree

6 files changed

+10
-10
lines changed

6 files changed

+10
-10
lines changed

‎src/backend/utils/adt/datetime.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4337,7 +4337,7 @@ pg_timezone_names(PG_FUNCTION_ARGS)
43374337
inttzoff;
43384338
structpg_tmtm;
43394339
fsec_tfsec;
4340-
char*tzn;
4340+
constchar*tzn;
43414341
Interval*resInterval;
43424342
structpg_tmitm;
43434343

‎src/backend/utils/adt/formatting.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ typedef struct TmToChar
459459
{
460460
structpg_tmtm;/* classic 'tm' struct */
461461
fsec_tfsec;/* fractional seconds */
462-
char*tzn;/* timezone */
462+
constchar*tzn;/* timezone */
463463
}TmToChar;
464464

465465
#definetmtcTm(_X)(&(_X)->tm)

‎src/backend/utils/adt/timestamp.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ timestamptz_out(PG_FUNCTION_ARGS)
494494
structpg_tmtt,
495495
*tm=&tt;
496496
fsec_tfsec;
497-
char*tzn;
497+
constchar*tzn;
498498
charbuf[MAXDATELEN+1];
499499

500500
if (TIMESTAMP_NOT_FINITE(dt))
@@ -1415,7 +1415,7 @@ timestamptz_to_str(TimestampTz t)
14151415
structpg_tmtt,
14161416
*tm=&tt;
14171417
fsec_tfsec;
1418-
char*tzn;
1418+
constchar*tzn;
14191419

14201420
if (TIMESTAMP_NOT_FINITE(t))
14211421
EncodeSpecialTimestamp(t,buf);
@@ -1466,7 +1466,7 @@ dt2time(Timestamp jd, int *hour, int *min, int *sec, fsec_t *fsec)
14661466
* timezone) will be used.
14671467
*/
14681468
int
1469-
timestamp2tm(Timestampdt,int*tzp,structpg_tm*tm,fsec_t*fsec,char**tzn,pg_tz*attimezone)
1469+
timestamp2tm(Timestampdt,int*tzp,structpg_tm*tm,fsec_t*fsec,constchar**tzn,pg_tz*attimezone)
14701470
{
14711471
Timestampdate;
14721472
Timestamptime;
@@ -1602,7 +1602,7 @@ timestamp2tm(Timestamp dt, int *tzp, struct pg_tm * tm, fsec_t *fsec, char **tzn
16021602
tm->tm_zone=tx->tm_zone;
16031603
*tzp=-tm->tm_gmtoff;
16041604
if (tzn!=NULL)
1605-
*tzn=(char*)tm->tm_zone;
1605+
*tzn=tm->tm_zone;
16061606
}
16071607
else
16081608
{

‎src/backend/utils/adt/xml.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2013,7 +2013,7 @@ map_sql_value_to_xml_value(Datum value, Oid type, bool xml_escape_strings)
20132013
structpg_tmtm;
20142014
inttz;
20152015
fsec_tfsec;
2016-
char*tzn=NULL;
2016+
constchar*tzn=NULL;
20172017
charbuf[MAXDATELEN+1];
20182018

20192019
timestamp=DatumGetTimestamp(value);

‎src/include/utils/timestamp.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ extern const char *timestamptz_to_str(TimestampTz t);
222222

223223
externinttm2timestamp(structpg_tm*tm,fsec_tfsec,int*tzp,Timestamp*dt);
224224
externinttimestamp2tm(Timestampdt,int*tzp,structpg_tm*tm,
225-
fsec_t*fsec,char**tzn,pg_tz*attimezone);
225+
fsec_t*fsec,constchar**tzn,pg_tz*attimezone);
226226
externvoiddt2time(Timestampdt,int*hour,int*min,int*sec,fsec_t*fsec);
227227

228228
externintinterval2tm(Intervalspan,structpg_tm*tm,fsec_t*fsec);

‎src/interfaces/ecpg/pgtypeslib/timestamp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ SetEpochTimestamp(void)
119119
*local time zone. If out of this range, leave as GMT. - tgl 97/05/27
120120
*/
121121
staticint
122-
timestamp2tm(timestampdt,int*tzp,structtm*tm,fsec_t*fsec,char**tzn)
122+
timestamp2tm(timestampdt,int*tzp,structtm*tm,fsec_t*fsec,constchar**tzn)
123123
{
124124
#ifdefHAVE_INT64_TIMESTAMP
125125
int64dDate,
@@ -224,7 +224,7 @@ timestamp2tm(timestamp dt, int *tzp, struct tm * tm, fsec_t *fsec, char **tzn)
224224

225225
*tzp=-tm->tm_gmtoff;/* tm_gmtoff is Sun/DEC-ism */
226226
if (tzn!=NULL)
227-
*tzn=(char*)tm->tm_zone;
227+
*tzn=tm->tm_zone;
228228
#elif defined(HAVE_INT_TIMEZONE)
229229
*tzp= (tm->tm_isdst>0) ?TIMEZONE_GLOBAL-SECS_PER_HOUR :TIMEZONE_GLOBAL;
230230
if (tzn!=NULL)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp