mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* time.c (rb_strftime): check errno to detect strftime(3)'s error.
this is workaround for recent version of MSVCRT. [ruby-dev:34456] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16113 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
fd8734a64d
commit
7dd42a48e1
2 changed files with 8 additions and 1 deletions
|
@ -1,3 +1,9 @@
|
|||
Mon Apr 21 09:58:04 2008 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||
|
||||
* time.c (rb_strftime): check errno to detect strftime(3)'s error.
|
||||
this is workaround for recent version of MSVCRT.
|
||||
[ruby-dev:34456]
|
||||
|
||||
Mon Apr 21 08:54:30 2008 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||
|
||||
* gc.c (ruby_xmalloc): use size_t for malloc argument instead of long.
|
||||
|
|
3
time.c
3
time.c
|
@ -2003,8 +2003,9 @@ rb_strftime(char **buf, const char *format, struct tm *time)
|
|||
if (flen == 0) {
|
||||
return 0;
|
||||
}
|
||||
errno = 0;
|
||||
len = strftime(*buf, SMALLBUF, format, time);
|
||||
if (len != 0 || **buf == '\0') return len;
|
||||
if (len != 0 || (**buf == '\0' && errno != ERANGE)) return len;
|
||||
for (size=1024; ; size*=2) {
|
||||
*buf = xmalloc(size);
|
||||
(*buf)[0] = '\0';
|
||||
|
|
Loading…
Add table
Reference in a new issue