[PATCH] Invalid gmtime() call

"Andrew Victor" <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
hi,

There is an invalid / unnecessary call to gmtime() in cs_dt_crack().
The input parameter 'time_t tmp_secs_from_epoch' is never initialized,
and result 'struct tm* t' is never used.

So the gmtime() call and variables can just be removed.


Regards,
  Andrew Victor

_______________________________________________
FreeTDS mailing list
[email protected]
http://lists.ibiblio.org/mailman/listinfo/freetds
bad_gmtime.patch (text/x-patch, 573 B)
diff -urN freetds-0.82/src/ctlib/cs.c freetds-0.82.new/src/ctlib/cs.c
--- freetds-0.82/src/ctlib/cs.c	2007-12-23 23:12:02.000000000 +0200
+++ freetds-0.82.new/src/ctlib/cs.c	2008-08-26 09:21:00.000000000 +0200
@@ -824,8 +824,6 @@
 {
 TDS_DATETIME *dt;
 TDS_DATETIME4 *dt4;
-time_t tmp_secs_from_epoch;
-struct tm *t;
 TDSDATEREC dr;
 
 	if (datetype == CS_DATETIME_TYPE) {
@@ -837,7 +835,6 @@
 	} else {
 		return CS_FAIL;
 	}
-	t = (struct tm *) gmtime(&tmp_secs_from_epoch);
 	daterec->dateyear = dr.year;
 	daterec->datemonth = dr.month;
 	daterec->datedmonth = dr.day;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.