1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/syck/rubyext.c (struct mktime_arg): constified.

* ext/syck/rubyext.c (mktime_do, mktime_r, rb_syck_mktime): fix
  function signatures.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29471 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2010-10-12 15:21:20 +00:00
parent 537d7ff140
commit 2d4e8b4e22
2 changed files with 21 additions and 11 deletions

View file

@ -1,3 +1,10 @@
Wed Oct 13 00:21:17 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/syck/rubyext.c (struct mktime_arg): constified.
* ext/syck/rubyext.c (mktime_do, mktime_r, rb_syck_mktime): fix
function signatures.
Wed Oct 13 00:18:18 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* st.c (MurmurMagic): get rid of literal overflow.

View file

@ -208,17 +208,18 @@ syck_get_hash_aref(VALUE hsh, VALUE key)
* creating timestamps
*/
struct mktime_arg {
char *str;
const char *str;
long len;
};
SYMID
mktime_do(struct mktime_arg *arg)
VALUE
mktime_do(VALUE varg)
{
struct mktime_arg *arg = (struct mktime_arg *)varg;
VALUE time;
char *str = arg->str;
const char *str = arg->str;
long len = arg->len;
char *ptr = str;
const char *ptr = str;
VALUE year = INT2FIX(0);
VALUE mon = INT2FIX(0);
VALUE day = INT2FIX(0);
@ -272,8 +273,8 @@ mktime_do(struct mktime_arg *arg)
if ( len > ptr - str && *ptr == '.' )
{
char padded[] = "000000";
char *end = ptr + 1;
char *p = end;
const char *end = ptr + 1;
const char *p = end;
while ( isdigit( *end ) ) end++;
if (end - p < (int)sizeof(padded)) {
MEMCPY(padded, ptr + 1, char, end - (ptr + 1));
@ -320,9 +321,11 @@ mktime_do(struct mktime_arg *arg)
}
}
SYMID
mktime_r(struct mktime_arg *arg)
VALUE
mktime_r(VALUE varg)
{
struct mktime_arg *arg = (struct mktime_arg *)varg;
if (!cDateTime) {
/*
* Load Date module
@ -333,8 +336,8 @@ mktime_r(struct mktime_arg *arg)
return rb_funcall(cDateTime, s_parse, 1, rb_str_new(arg->str, arg->len));
}
SYMID
rb_syck_mktime(char *str, long len)
VALUE
rb_syck_mktime(const char *str, long len)
{
struct mktime_arg a;