ruby-changes:43245
From: nobu <ko1@a...>
Date: Wed, 8 Jun 2016 10:09:29 +0900 (JST)
Subject: [ruby-changes:43245] nobu:r55318 (trunk): ext/date: constify
nobu 2016-06-08 10:09:21 +0900 (Wed, 08 Jun 2016) New Revision: 55318 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55318 Log: ext/date: constify Modified files: trunk/ext/date/date_core.c trunk/ext/date/date_parse.c trunk/ext/date/date_tmx.h Index: ext/date/date_core.c =================================================================== --- ext/date/date_core.c (revision 55317) +++ ext/date/date_core.c (revision 55318) @@ -6602,7 +6602,7 @@ tmx_m_zone(union DateData *x) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L6602 return RSTRING_PTR(m_zone(x)); } -static struct tmx_funcs tmx_funcs = { +static const struct tmx_funcs tmx_funcs = { (VALUE (*)(void *))m_real_year, (int (*)(void *))m_yday, (int (*)(void *))m_mon, Index: ext/date/date_parse.c =================================================================== --- ext/date/date_parse.c (revision 55317) +++ ext/date/date_parse.c (revision 55318) @@ -44,12 +44,12 @@ https://github.com/ruby/ruby/blob/trunk/ext/date/date_parse.c#L44 #define cstr2num(s) rb_cstr_to_inum(s, 10, 0) #define str2num(s) rb_str_to_inum(s, 10, 0) -static const char *abbr_days[] = { +static const char abbr_days[][4] = { "sun", "mon", "tue", "wed", "thu", "fri", "sat" }; -static const char *abbr_months[] = { +static const char abbr_months[][4] = { "jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec" }; @@ -342,7 +342,7 @@ struct zone { https://github.com/ruby/ruby/blob/trunk/ext/date/date_parse.c#L342 int offset; }; -static struct zone zones_source[] = { +static const struct zone zones_source[] = { {"ut", 0*3600}, {"gmt", 0*3600}, {"est", -5*3600}, {"edt", -4*3600}, {"cst", -6*3600}, {"cdt", -5*3600}, {"mst", -7*3600}, {"mdt", -6*3600}, {"pst", -8*3600}, {"pdt", -7*3600}, Index: ext/date/date_tmx.h =================================================================== --- ext/date/date_tmx.h (revision 55317) +++ ext/date/date_tmx.h (revision 55318) @@ -23,7 +23,7 @@ struct tmx_funcs { https://github.com/ruby/ruby/blob/trunk/ext/date/date_tmx.h#L23 }; struct tmx { void *dat; - struct tmx_funcs *funcs; + const struct tmx_funcs *funcs; }; #define tmx_attr(x) (tmx->funcs->x)(tmx->dat) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/