[前][次][番号順一覧][スレッド一覧]

ruby-changes:43466

From: nobu <ko1@a...>
Date: Thu, 30 Jun 2016 13:16:50 +0900 (JST)
Subject: [ruby-changes:43466] nobu:r55540 (trunk): Initialize ID

nobu	2016-06-30 13:16:43 +0900 (Thu, 30 Jun 2016)

  New Revision: 55540

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55540

  Log:
    Initialize ID
    
    * ext/cgi/escape/escape.c (accept_charset): initialize the static
      ID for theha class variable once at first.

  Modified files:
    trunk/ext/cgi/escape/escape.c
Index: ext/cgi/escape/escape.c
===================================================================
--- ext/cgi/escape/escape.c	(revision 55539)
+++ ext/cgi/escape/escape.c	(revision 55540)
@@ -9,6 +9,7 @@ RUBY_EXTERN const signed char ruby_digit https://github.com/ruby/ruby/blob/trunk/ext/cgi/escape/escape.c#L9
 #define char_to_number(c) ruby_digit36_to_number_table[(unsigned char)(c)]
 
 static VALUE rb_cCGI, rb_mUtil, rb_mEscape;
+static ID id_accept_charset;
 
 static void
 html_escaped_cat(VALUE str, char c)
@@ -186,7 +187,7 @@ optimized_unescape_html(VALUE str) https://github.com/ruby/ruby/blob/trunk/ext/cgi/escape/escape.c#L187
     }
 }
 
-static int
+static unsigned char
 url_unreserved_char(unsigned char c)
 {
     switch (c) {
@@ -374,7 +375,7 @@ accept_charset(int argc, VALUE *argv, VA https://github.com/ruby/ruby/blob/trunk/ext/cgi/escape/escape.c#L375
 {
     if (argc > 0)
 	return argv[0];
-    return rb_cvar_get(CLASS_OF(self), rb_intern("@@accept_charset"));
+    return rb_cvar_get(CLASS_OF(self), id_accept_charset);
 }
 
 /*
@@ -403,6 +404,13 @@ cgiesc_unescape(int argc, VALUE *argv, V https://github.com/ruby/ruby/blob/trunk/ext/cgi/escape/escape.c#L404
 void
 Init_escape(void)
 {
+    id_accept_charset = rb_intern_const("@@accept_charset");
+    InitVM(escape);
+}
+
+void
+InitVM_escape(void)
+{
     rb_cCGI    = rb_define_class("CGI", rb_cObject);
     rb_mEscape = rb_define_module_under(rb_cCGI, "Escape");
     rb_mUtil   = rb_define_module_under(rb_cCGI, "Util");

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]