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

Commitc341c7d

Browse files
committed
Fix some compiler warnings with timestamp parsing in formatting.c
gcc-7 used with a sufficient optimization level complains about warningsaround do_to_timestamp() regarding the initialization and handling ofsome of its variables. Recent commits 66c74f8 andd589f94 made thingsmade the interface more confusing, so document which variables arealways expected and initialize properly the optional ones when they areset.Author: Andrey Lepikhov, Michael PaquierDiscussion:https://postgr.es/m/a7e28b83-27b1-4e1c-c76b-4268c4b785bc@postgrespro.ru
1 parent8729fa7 commitc341c7d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4128,7 +4128,7 @@ parse_datetime(text *date_txt, text *fmt, bool strict, Oid *typid,
41284128
{
41294129
structpg_tmtm;
41304130
fsec_tfsec;
4131-
intfprec=0;
4131+
intfprec;
41324132
uint32flags;
41334133

41344134
do_to_timestamp(date_txt,fmt,strict,&tm,&fsec,&fprec,&flags,have_error);
@@ -4318,11 +4318,18 @@ do_to_timestamp(text *date_txt, text *fmt, bool std,
43184318
intfmask;
43194319
boolincache= false;
43204320

4321+
Assert(tm!=NULL);
4322+
Assert(fsec!=NULL);
4323+
43214324
date_str=text_to_cstring(date_txt);
43224325

43234326
ZERO_tmfc(&tmfc);
43244327
ZERO_tm(tm);
43254328
*fsec=0;
4329+
if (fprec)
4330+
*fprec=0;
4331+
if (flags)
4332+
*flags=0;
43264333
fmask=0;/* bit mask for ValidateDate() */
43274334

43284335
fmt_len=VARSIZE_ANY_EXHDR(fmt);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp