mirror of
https://github.com/python/cpython.git
synced 2025-11-03 03:22:27 +00:00
Use PyOS_snprintf for better portability.
This commit is contained in:
parent
003428158b
commit
ecbb8dc17a
1 changed files with 5 additions and 5 deletions
|
|
@ -605,11 +605,11 @@ _asctime(struct tm *timeptr)
|
||||||
char buf[20]; /* 'Sun Sep 16 01:03:52\0' */
|
char buf[20]; /* 'Sun Sep 16 01:03:52\0' */
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
n = snprintf(buf, sizeof(buf), "%.3s %.3s%3d %.2d:%.2d:%.2d",
|
n = PyOS_snprintf(buf, sizeof(buf), "%.3s %.3s%3d %.2d:%.2d:%.2d",
|
||||||
wday_name[timeptr->tm_wday],
|
wday_name[timeptr->tm_wday],
|
||||||
mon_name[timeptr->tm_mon],
|
mon_name[timeptr->tm_mon],
|
||||||
timeptr->tm_mday, timeptr->tm_hour,
|
timeptr->tm_mday, timeptr->tm_hour,
|
||||||
timeptr->tm_min, timeptr->tm_sec);
|
timeptr->tm_min, timeptr->tm_sec);
|
||||||
/* XXX: since the fields used by snprintf above are validated in checktm,
|
/* XXX: since the fields used by snprintf above are validated in checktm,
|
||||||
* the following condition should never trigger. We keep the check because
|
* the following condition should never trigger. We keep the check because
|
||||||
* historically fixed size buffer used in asctime was the source of
|
* historically fixed size buffer used in asctime was the source of
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue