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

ruby-changes:44879

From: nobu <ko1@a...>
Date: Thu, 1 Dec 2016 09:34:47 +0900 (JST)
Subject: [ruby-changes:44879] nobu:r56952 (trunk): Use offsetof macro and shrink table size

nobu	2016-12-01 09:34:42 +0900 (Thu, 01 Dec 2016)

  New Revision: 56952

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

  Log:
    Use offsetof macro and shrink table size

  Modified files:
    trunk/enc/unicode/9.0.0/name2ctype.h
    trunk/tool/enc-unicode.rb
Index: enc/unicode/9.0.0/name2ctype.h
===================================================================
--- enc/unicode/9.0.0/name2ctype.h	(revision 56951)
+++ enc/unicode/9.0.0/name2ctype.h	(revision 56952)
@@ -34,7 +34,6 @@ error "gperf generated tables don't work https://github.com/ruby/ruby/blob/trunk/enc/unicode/9.0.0/name2ctype.h#L34
 #endif
 
 
-#define long size_t
 
 /* 'NEWLINE': [[:NEWLINE:]] */
 static const OnigCodePoint CR_NEWLINE[] = {
@@ -33186,7 +33185,8 @@ static const OnigCodePoint* const CodeRa https://github.com/ruby/ruby/blob/trunk/enc/unicode/9.0.0/name2ctype.h#L33185
 #endif /* USE_UNICODE_PROPERTIES */
 };
 struct uniname2ctype_struct {
-  int name, ctype;
+  short name;
+  unsigned short ctype;
 };
 
 static const struct uniname2ctype_struct *uniname2ctype_p(const char *, unsigned int);
@@ -34940,1326 +34940,1326 @@ uniname2ctype_p (str, len) https://github.com/ruby/ruby/blob/trunk/enc/unicode/9.0.0/name2ctype.h#L34940
     {
 #ifdef USE_UNICODE_PROPERTIES
       {-1}, {-1}, {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str3,                                        34},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str3), 34},
       {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str11,                                       33},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str11), 33},
       {-1}, {-1}, {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str15,                                        30},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str15), 30},
       {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str24,                                       20},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str24), 20},
       {-1}, {-1}, {-1}, {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str29,                                    185},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str30,                                       60},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str31,                            474},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str29), 185},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str30), 60},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str31), 474},
       {-1}, {-1}, {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str35,                                        51},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str36,                                    114},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str35), 51},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str36), 114},
       {-1}, {-1}, {-1}, {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str41,                                        17},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str41), 17},
       {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str49,                                       31},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str49), 31},
       {-1}, {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str52,                                    128},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str52), 128},
       {-1}, {-1}, {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str56,                                       49},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str56), 49},
       {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str58,                                  416},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str59,                                       32},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str58), 416},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str59), 32},
       {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str61,                              290},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str62,                                       18},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str61), 290},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str62), 18},
       {-1}, {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str65,                                 168},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str65), 168},
       {-1}, {-1}, {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str69,                             504},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str69), 504},
       {-1}, {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str72,                                    244},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str72), 244},
       {-1}, {-1}, {-1}, {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str77,                             297},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str78,                                    101},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str77), 297},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str78), 101},
       {-1}, {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str81,                                        46},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str82,                                       47},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str81), 46},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str82), 47},
       {-1}, {-1}, {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str86,                                    14},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str86), 14},
       {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str93,                               475},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str93), 475},
       {-1}, {-1}, {-1}, {-1}, {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str99,                                       54},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str99), 54},
       {-1}, {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str102,                                       22},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str102), 22},
       {-1}, {-1}, {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str106,                         284},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str106), 284},
       {-1}, {-1}, {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str110,        505},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str110), 505},
       {-1}, {-1}, {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str114,                407},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str114), 407},
       {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str124,                                  310},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str124), 310},
       {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str132,                                    159},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str132), 159},
       {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str140,                              440},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str141,                       43},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str140), 440},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str141), 43},
       {-1}, {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str144,                                295},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str145,                        445},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str144), 295},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str145), 445},
       {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str152,     366},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str152), 366},
       {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str159,                        521},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str159), 521},
       {-1}, {-1}, {-1}, {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str164,                                   120},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str164), 120},
       {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str174,                      417},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str174), 417},
       {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str176,                                   239},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str176), 239},
       {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str185,                                       26},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str185), 26},
       {-1}, {-1}, {-1}, {-1}, {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str191,                                    183},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str191), 183},
       {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str199,                  364},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str200,                                    151},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str201,                539},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str202,                                    13},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str199), 364},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str200), 151},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str201), 539},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str202), 13},
       {-1}, {-1}, {-1}, {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str207,                                447},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str208,         372},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str209,                               334},
-      {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str211,                                       24},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str212,                             308},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str213,    536},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str214,                                 529},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str207), 447},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str208), 372},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str209), 334},
+      {-1},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str211), 24},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str212), 308},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str213), 536},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str214), 529},
       {-1}, {-1}, {-1}, {-1}, {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str220,                       358},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str220), 358},
       {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str222,                               461},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str222), 461},
       {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
       {-1}, {-1}, {-1}, {-1}, {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str237,                                 152},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str237), 152},
       {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str239,                                     78},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str239), 78},
       {-1}, {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str242,                                    160},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str242), 160},
       {-1}, {-1}, {-1}, {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str247,                                  92},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str248,                                 78},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str249,                               313},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str247), 92},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str248), 78},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str249), 313},
       {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str251,                                 321},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str252,                                448},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str251), 321},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str252), 448},
       {-1}, {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str255,                                    148},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str256,                               503},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str255), 148},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str256), 503},
       {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str258,                                    207},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str258), 207},
       {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str268,                                  148},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str268), 148},
       {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str270,                                    170},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str270), 170},
       {-1}, {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str273,                              288},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str273), 288},
       {-1}, {-1}, {-1}, {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str278,                                    155},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str279,                                     75},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str278), 155},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str279), 75},
       {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str281,                                    75},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str282,                                    111},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str281), 75},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str282), 111},
       {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str284,                                 305},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str285,                                     88},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str286,                               490},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str284), 305},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str285), 88},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str286), 490},
       {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str288,                               155},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str288), 155},
       {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str290,                                   80},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str291,                                293},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str290), 80},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str291), 293},
       {-1}, {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str294,                               487},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str295,                                    172},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str296,                      442},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str294), 487},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str295), 172},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str296), 442},
       {-1}, {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str299,                              318},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str299), 318},
       {-1}, {-1},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str302,                                 330},
-      {(int)(long)&((struct uniname2ctype_pool_t *)0)->uniname2ctype_pool_str303,                                    120},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_pool_str302), 330},
+      {offsetof(struct uniname2ctype_pool_t, uniname2ctype_poo (... truncated)

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

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