summaryrefslogtreecommitdiff
path: root/process.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-02-25 04:58:47 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-02-25 04:58:47 +0000
commitacfeeb22593523d75ed65093fbd8108c86ea67a8 (patch)
tree8584ce0d112dd996ca16a045298e9de941e0d91c /process.c
parent56faedc99de61eda8664ae447463ac76b8db1d8a (diff)
* process.c (Init_process): share bignum objects for RLIM_INFINITY,
RLIM_SAVED_MAX and RLIM_SAVED_CUR if they are equal. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@15596 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'process.c')
-rw-r--r--process.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/process.c b/process.c
index 6276f46728..a3421f57c3 100644
--- a/process.c
+++ b/process.c
@@ -3630,15 +3630,18 @@ Init_process()
rb_define_module_function(rb_mProcess, "getrlimit", proc_getrlimit, 1);
rb_define_module_function(rb_mProcess, "setrlimit", proc_setrlimit, -1);
#ifdef RLIM2NUM
-#ifdef RLIM_INFINITY
- rb_define_const(rb_mProcess, "RLIM_INFINITY", RLIM2NUM(RLIM_INFINITY));
-#endif
+ {
+ VALUE inf = RLIM2NUM(RLIM_INFINITY), v;
+ rb_define_const(rb_mProcess, "RLIM_INFINITY", inf);
#ifdef RLIM_SAVED_MAX
- rb_define_const(rb_mProcess, "RLIM_SAVED_MAX", RLIM2NUM(RLIM_SAVED_MAX));
+ v = RLIM_INFINITY == RLIM_SAVED_MAX ? inf : RLIM2NUM(RLIM_SAVED_MAX);
+ rb_define_const(rb_mProcess, "RLIM_SAVED_MAX", v);
#endif
#ifdef RLIM_SAVED_CUR
- rb_define_const(rb_mProcess, "RLIM_SAVED_CUR", RLIM2NUM(RLIM_SAVED_CUR));
+ v = RLIM_INFINITY == RLIM_SAVED_CUR ? inf : RLIM2NUM(RLIM_SAVED_CUR);
+ rb_define_const(rb_mProcess, "RLIM_SAVED_CUR", v);
#endif
+ }
#ifdef RLIMIT_CORE
rb_define_const(rb_mProcess, "RLIMIT_CORE", INT2FIX(RLIMIT_CORE));
#endif