From 350e6ed84b4ee661b2da255d298b9060991375ee Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 19 Jun 2008 08:45:25 +0000 Subject: * ext/etc/etc.c (Init_etc): define constant aliases Etc::Passwd and Etc::Group. [ruby-dev:35150] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17428 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ ext/etc/etc.c | 10 ++++------ 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 906eef96b3..accf2002a4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Jun 19 17:44:15 2008 Yukihiro Matsumoto + + * 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 * string.c (str_alloc): specify 'inline' modifier. diff --git a/ext/etc/etc.c b/ext/etc/etc.c index 6cff5ba7ad..f09c8d76db 100644 --- a/ext/etc/etc.c +++ b/ext/etc/etc.c @@ -482,8 +482,6 @@ etc_getgrent(VALUE obj) 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 @@ static VALUE mEtc; 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,8 +534,7 @@ Init_etc(void) "expire", #endif NULL); - - rb_register_mark_object(sPasswd); + rb_define_const(mEtc, "Passwd", sPasswd); #ifdef HAVE_GETGRENT sGroup = rb_struct_define("Group", "name", @@ -545,6 +543,6 @@ Init_etc(void) #endif "gid", "mem", NULL); - rb_register_mark_object(sGroup); + rb_define_const(mEtc, "Group", sGroup); #endif } -- cgit v1.2.3