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

ruby-changes:49690

From: mame <ko1@a...>
Date: Sat, 13 Jan 2018 21:25:20 +0900 (JST)
Subject: [ruby-changes:49690] mame:r61807 (trunk): file.c (struct apply_arg): Use FLEX_ARY_LEN

mame	2018-01-13 21:25:15 +0900 (Sat, 13 Jan 2018)

  New Revision: 61807

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

  Log:
    file.c (struct apply_arg): Use FLEX_ARY_LEN

  Modified files:
    trunk/file.c
Index: file.c
===================================================================
--- file.c	(revision 61806)
+++ file.c	(revision 61807)
@@ -361,7 +361,7 @@ struct apply_arg { https://github.com/ruby/ruby/blob/trunk/file.c#L361
     int errnum;
     int (*func)(const char *, void *);
     void *arg;
-    struct apply_filename fn[1]; /* flexible array */
+    struct apply_filename fn[FLEX_ARY_LEN];
 };
 
 static void *
@@ -388,7 +388,7 @@ apply2files(int (*func)(const char *, vo https://github.com/ruby/ruby/blob/trunk/file.c#L388
 {
     VALUE v;
     const size_t size = sizeof(struct apply_filename);
-    const long len = (long)(offsetof(struct apply_arg, fn) + (size * argc));
+    const long len = (long)(sizeof(struct apply_arg) + (size * argc));
     struct apply_arg *aa = ALLOCV(v, len);
 
     aa->errnum = 0;

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

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