diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-02-25 04:58:47 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-02-25 04:58:47 +0000 |
commit | acfeeb22593523d75ed65093fbd8108c86ea67a8 (patch) | |
tree | 8584ce0d112dd996ca16a045298e9de941e0d91c /process.c | |
parent | 56faedc99de61eda8664ae447463ac76b8db1d8a (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.c | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -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 |