remove unnecessary assignment to tmask in DecodeDateTime

Started by Zhihong Yuabout 3 years ago1 messages
#1Zhihong Yu
zyu@yugabyte.com
1 attachment(s)

Hi,
I was looking at the code in DecodeDateTime() around line 1382:

tmask = DTK_M(type);

In case type is UNKNOWN_FIELD, the above macro would shift 1 left 31 bits
which cannot be represented in type 'int'.

Looking down in the same function, we can see that tmask is assigned for
every legitimate case.

If my understanding is correct, please take a look at the proposed patch.

Thanks

Attachments:

tmask-decode-date-time.patchapplication/octet-stream; name=tmask-decode-date-time.patchDownload
diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c
index 8cd10ab204..6b50a22832 100644
--- a/src/backend/utils/adt/datetime.c
+++ b/src/backend/utils/adt/datetime.c
@@ -1382,7 +1382,6 @@ DecodeDateTime(char **field, int *ftype, int nf,
 				if (type == IGNORE_DTF)
 					continue;
 
-				tmask = DTK_M(type);
 				switch (type)
 				{
 					case RESERV: