Andrew Victor | 26 Aug 12:37

[PATCH] Invalid gmtime() call

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
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;
_______________________________________________
FreeTDS mailing list
FreeTDS <at> lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds

Gmane