[Python-checkins] r87795 - python/branches/py3k/Modules/timemodule.c

alexander.belopolsky python-checkins at python.org
Thu Jan 6 17:45:25 CET 2011


Author: alexander.belopolsky
Date: Thu Jan  6 17:45:25 2011
New Revision: 87795

Log:
Use PyOS_snprintf for better portability.

Modified:
   python/branches/py3k/Modules/timemodule.c

Modified: python/branches/py3k/Modules/timemodule.c
==============================================================================
--- python/branches/py3k/Modules/timemodule.c	(original)
+++ python/branches/py3k/Modules/timemodule.c	Thu Jan  6 17:45:25 2011
@@ -605,11 +605,11 @@
     char buf[20]; /* 'Sun Sep 16 01:03:52\0' */
     int n;
 
-    n = snprintf(buf, sizeof(buf), "%.3s %.3s%3d %.2d:%.2d:%.2d",
-                 wday_name[timeptr->tm_wday],
-                 mon_name[timeptr->tm_mon],
-                 timeptr->tm_mday, timeptr->tm_hour,
-                 timeptr->tm_min, timeptr->tm_sec);
+    n = PyOS_snprintf(buf, sizeof(buf), "%.3s %.3s%3d %.2d:%.2d:%.2d",
+                      wday_name[timeptr->tm_wday],
+                      mon_name[timeptr->tm_mon],
+                      timeptr->tm_mday, timeptr->tm_hour,
+                      timeptr->tm_min, timeptr->tm_sec);
     /* XXX: since the fields used by snprintf above are validated in checktm,
      * the following condition should never trigger. We keep the check because
      * historically fixed size buffer used in asctime was the source of


More information about the Python-checkins mailing list