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

ruby-changes:5920

From: matz <ko1@a...>
Date: Thu, 19 Jun 2008 17:45:44 +0900 (JST)
Subject: [ruby-changes:5920] Ruby:r17428 (trunk): * ext/etc/etc.c (Init_etc): define constant aliases Etc::Passwd

matz	2008-06-19 17:45:25 +0900 (Thu, 19 Jun 2008)

  New Revision: 17428

  Modified files:
    trunk/ChangeLog
    trunk/ext/etc/etc.c

  Log:
    * ext/etc/etc.c (Init_etc): define constant aliases Etc::Passwd
      and Etc::Group.  [ruby-dev:35150]

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=17428&r2=17427&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ext/etc/etc.c?r1=17428&r2=17427&diff_format=u

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 17427)
+++ ChangeLog	(revision 17428)
@@ -1,3 +1,8 @@
+Thu Jun 19 17:44:15 2008  Yukihiro Matsumoto  <matz@r...>
+
+	* ext/etc/etc.c (Init_etc): define constant aliases Etc::Passwd
+	  and Etc::Group.  [ruby-dev:35150]
+
 Thu Jun 19 17:37:21 2008  Yukihiro Matsumoto  <matz@r...>
 
 	* string.c (str_alloc): specify 'inline' modifier.
Index: ext/etc/etc.c
===================================================================
--- ext/etc/etc.c	(revision 17427)
+++ ext/etc/etc.c	(revision 17428)
@@ -482,8 +482,6 @@
     return Qnil;
 }
 
-static VALUE mEtc;
-
 /* The etc module provides access to information from the /etc/passwd and
  * /etc/group files on Linux and Unix systems.
  *
@@ -492,8 +490,9 @@
 void
 Init_etc(void)
 {
-    mEtc = rb_define_module("Etc");
+    VALUE mEtc;
 
+    mEtc = rb_define_module("Etc");
     rb_define_module_function(mEtc, "getlogin", etc_getlogin, 0);
 
     rb_define_module_function(mEtc, "getpwuid", etc_getpwuid, -1);
@@ -535,9 +534,8 @@
 				"expire",
 #endif
 				NULL);
+    rb_define_const(mEtc, "Passwd", sPasswd);
 
-    rb_register_mark_object(sPasswd);
-
 #ifdef HAVE_GETGRENT
     sGroup = rb_struct_define("Group", "name",
 #ifdef HAVE_ST_GR_PASSWD
@@ -545,6 +543,6 @@
 #endif
 			      "gid", "mem", NULL);
 
-    rb_register_mark_object(sGroup);
+    rb_define_const(mEtc, "Group", sGroup);
 #endif
 }

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

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