mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/date/date_core.c: reverted r34825.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34851 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
f3b685d198
commit
f400ba1082
2 changed files with 21 additions and 18 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
Wed Feb 29 06:14:51 2012 Tadayoshi Funaba <tadf@dotrb.org>
|
||||||
|
|
||||||
|
* ext/date/date_core.c: reverted r34825.
|
||||||
|
|
||||||
Tue Feb 28 23:20:01 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
|
Tue Feb 28 23:20:01 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
|
||||||
|
|
||||||
* Makefile.in (PLATFORM_DIR): add a variable for `win32` directory.
|
* Makefile.in (PLATFORM_DIR): add a variable for `win32` directory.
|
||||||
|
|
|
@ -6587,7 +6587,7 @@ d_lite_hash(VALUE self)
|
||||||
|
|
||||||
#include "date_tmx.h"
|
#include "date_tmx.h"
|
||||||
static void set_tmx(VALUE, struct tmx *);
|
static void set_tmx(VALUE, struct tmx *);
|
||||||
static VALUE strftimev(VALUE, const char *, VALUE,
|
static VALUE strftimev(const char *, VALUE,
|
||||||
void (*)(VALUE, struct tmx *));
|
void (*)(VALUE, struct tmx *));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -6604,7 +6604,7 @@ static VALUE strftimev(VALUE, const char *, VALUE,
|
||||||
static VALUE
|
static VALUE
|
||||||
d_lite_to_s(VALUE self)
|
d_lite_to_s(VALUE self)
|
||||||
{
|
{
|
||||||
return strftimev(Qnil, "%Y-%m-%d", self, set_tmx);
|
return strftimev("%Y-%m-%d", self, set_tmx);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
|
@ -6729,7 +6729,7 @@ size_t date_strftime(char *s, size_t maxsize, const char *format,
|
||||||
|
|
||||||
#define SMALLBUF 100
|
#define SMALLBUF 100
|
||||||
static size_t
|
static size_t
|
||||||
date_strftime_alloc(char **buf, VALUE formatv, const char *format,
|
date_strftime_alloc(char **buf, const char *format,
|
||||||
struct tmx *tmx)
|
struct tmx *tmx)
|
||||||
{
|
{
|
||||||
size_t size, len, flen;
|
size_t size, len, flen;
|
||||||
|
@ -6756,7 +6756,6 @@ date_strftime_alloc(char **buf, VALUE formatv, const char *format,
|
||||||
if (len > 0) break;
|
if (len > 0) break;
|
||||||
xfree(*buf);
|
xfree(*buf);
|
||||||
if (size >= 1024 * flen) {
|
if (size >= 1024 * flen) {
|
||||||
if (!NIL_P(formatv)) rb_sys_fail_str(formatv);
|
|
||||||
rb_sys_fail(format);
|
rb_sys_fail(format);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -6869,7 +6868,7 @@ date_strftime_internal(int argc, VALUE *argv, VALUE self,
|
||||||
|
|
||||||
str = rb_str_new(0, 0);
|
str = rb_str_new(0, 0);
|
||||||
while (p < pe) {
|
while (p < pe) {
|
||||||
len = date_strftime_alloc(&buf, vfmt, p, &tmx);
|
len = date_strftime_alloc(&buf, p, &tmx);
|
||||||
rb_str_cat(str, buf, len);
|
rb_str_cat(str, buf, len);
|
||||||
p += strlen(p);
|
p += strlen(p);
|
||||||
if (buf != buffer) {
|
if (buf != buffer) {
|
||||||
|
@ -6884,7 +6883,7 @@ date_strftime_internal(int argc, VALUE *argv, VALUE self,
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
len = date_strftime_alloc(&buf, vfmt, fmt, &tmx);
|
len = date_strftime_alloc(&buf, fmt, &tmx);
|
||||||
|
|
||||||
str = rb_str_new(buf, len);
|
str = rb_str_new(buf, len);
|
||||||
if (buf != buffer) xfree(buf);
|
if (buf != buffer) xfree(buf);
|
||||||
|
@ -7078,7 +7077,7 @@ d_lite_strftime(int argc, VALUE *argv, VALUE self)
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
strftimev(VALUE vfmt, const char *fmt, VALUE self,
|
strftimev(const char *fmt, VALUE self,
|
||||||
void (*func)(VALUE, struct tmx *))
|
void (*func)(VALUE, struct tmx *))
|
||||||
{
|
{
|
||||||
char buffer[SMALLBUF], *buf = buffer;
|
char buffer[SMALLBUF], *buf = buffer;
|
||||||
|
@ -7087,7 +7086,7 @@ strftimev(VALUE vfmt, const char *fmt, VALUE self,
|
||||||
VALUE str;
|
VALUE str;
|
||||||
|
|
||||||
(*func)(self, &tmx);
|
(*func)(self, &tmx);
|
||||||
len = date_strftime_alloc(&buf, vfmt, fmt, &tmx);
|
len = date_strftime_alloc(&buf, fmt, &tmx);
|
||||||
str = rb_usascii_str_new(buf, len);
|
str = rb_usascii_str_new(buf, len);
|
||||||
if (buf != buffer) xfree(buf);
|
if (buf != buffer) xfree(buf);
|
||||||
return str;
|
return str;
|
||||||
|
@ -7106,7 +7105,7 @@ strftimev(VALUE vfmt, const char *fmt, VALUE self,
|
||||||
static VALUE
|
static VALUE
|
||||||
d_lite_asctime(VALUE self)
|
d_lite_asctime(VALUE self)
|
||||||
{
|
{
|
||||||
return strftimev(Qnil, "%a %b %e %H:%M:%S %Y", self, set_tmx);
|
return strftimev("%a %b %e %H:%M:%S %Y", self, set_tmx);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -7119,7 +7118,7 @@ d_lite_asctime(VALUE self)
|
||||||
static VALUE
|
static VALUE
|
||||||
d_lite_iso8601(VALUE self)
|
d_lite_iso8601(VALUE self)
|
||||||
{
|
{
|
||||||
return strftimev(Qnil, "%Y-%m-%d", self, set_tmx);
|
return strftimev("%Y-%m-%d", self, set_tmx);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -7131,7 +7130,7 @@ d_lite_iso8601(VALUE self)
|
||||||
static VALUE
|
static VALUE
|
||||||
d_lite_rfc3339(VALUE self)
|
d_lite_rfc3339(VALUE self)
|
||||||
{
|
{
|
||||||
return strftimev(Qnil, "%Y-%m-%dT%H:%M:%S%:z", self, set_tmx);
|
return strftimev("%Y-%m-%dT%H:%M:%S%:z", self, set_tmx);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -7144,7 +7143,7 @@ d_lite_rfc3339(VALUE self)
|
||||||
static VALUE
|
static VALUE
|
||||||
d_lite_rfc2822(VALUE self)
|
d_lite_rfc2822(VALUE self)
|
||||||
{
|
{
|
||||||
return strftimev(Qnil, "%a, %-d %b %Y %T %z", self, set_tmx);
|
return strftimev("%a, %-d %b %Y %T %z", self, set_tmx);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -7158,7 +7157,7 @@ static VALUE
|
||||||
d_lite_httpdate(VALUE self)
|
d_lite_httpdate(VALUE self)
|
||||||
{
|
{
|
||||||
volatile VALUE dup = dup_obj_with_new_offset(self, 0);
|
volatile VALUE dup = dup_obj_with_new_offset(self, 0);
|
||||||
return strftimev(Qnil, "%a, %d %b %Y %T GMT", dup, set_tmx);
|
return strftimev("%a, %d %b %Y %T GMT", dup, set_tmx);
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
|
@ -7205,7 +7204,7 @@ d_lite_jisx0301(VALUE self)
|
||||||
get_d1(self);
|
get_d1(self);
|
||||||
s = jisx0301_date(m_real_local_jd(dat),
|
s = jisx0301_date(m_real_local_jd(dat),
|
||||||
m_real_year(dat));
|
m_real_year(dat));
|
||||||
return strftimev(s, RSTRING_PTR(s), self, set_tmx);
|
return strftimev(RSTRING_PTR(s), self, set_tmx);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
|
@ -8295,7 +8294,7 @@ datetime_s_jisx0301(int argc, VALUE *argv, VALUE klass)
|
||||||
static VALUE
|
static VALUE
|
||||||
dt_lite_to_s(VALUE self)
|
dt_lite_to_s(VALUE self)
|
||||||
{
|
{
|
||||||
return strftimev(Qnil, "%Y-%m-%dT%H:%M:%S%:z", self, set_tmx);
|
return strftimev("%Y-%m-%dT%H:%M:%S%:z", self, set_tmx);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -8502,7 +8501,7 @@ iso8601_timediv(VALUE self, VALUE n)
|
||||||
rb_str_append(fmt, rb_f_sprintf(3, argv));
|
rb_str_append(fmt, rb_f_sprintf(3, argv));
|
||||||
}
|
}
|
||||||
rb_str_append(fmt, rb_usascii_str_new2("%:z"));
|
rb_str_append(fmt, rb_usascii_str_new2("%:z"));
|
||||||
return strftimev(fmt, RSTRING_PTR(fmt), self, set_tmx);
|
return strftimev(RSTRING_PTR(fmt), self, set_tmx);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -8528,7 +8527,7 @@ dt_lite_iso8601(int argc, VALUE *argv, VALUE self)
|
||||||
if (argc < 1)
|
if (argc < 1)
|
||||||
n = INT2FIX(0);
|
n = INT2FIX(0);
|
||||||
|
|
||||||
return f_add(strftimev(Qnil, "%Y-%m-%d", self, set_tmx),
|
return f_add(strftimev("%Y-%m-%d", self, set_tmx),
|
||||||
iso8601_timediv(self, n));
|
iso8601_timediv(self, n));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8576,7 +8575,7 @@ dt_lite_jisx0301(int argc, VALUE *argv, VALUE self)
|
||||||
get_d1(self);
|
get_d1(self);
|
||||||
s = jisx0301_date(m_real_local_jd(dat),
|
s = jisx0301_date(m_real_local_jd(dat),
|
||||||
m_real_year(dat));
|
m_real_year(dat));
|
||||||
return rb_str_append(strftimev(s, RSTRING_PTR(s), self, set_tmx),
|
return rb_str_append(strftimev(RSTRING_PTR(s), self, set_tmx),
|
||||||
iso8601_timediv(self, n));
|
iso8601_timediv(self, n));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue