From 2d4e8b4e22e966f2da9dd8bb9ea0b008e0d1d26c Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 12 Oct 2010 15:21:20 +0000 Subject: [PATCH] * 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 --- ChangeLog | 7 +++++++ ext/syck/rubyext.c | 25 ++++++++++++++----------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index ab50b6c05f..ccc150821d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Wed Oct 13 00:21:17 2010 Nobuyoshi Nakada + + * 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 * st.c (MurmurMagic): get rid of literal overflow. diff --git a/ext/syck/rubyext.c b/ext/syck/rubyext.c index cd5b4f2049..282f05273f 100644 --- a/ext/syck/rubyext.c +++ b/ext/syck/rubyext.c @@ -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;