diff options
Diffstat (limited to 'ext/curses/curses.c')
-rw-r--r-- | ext/curses/curses.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/ext/curses/curses.c b/ext/curses/curses.c index 69dc09cf30..20f23d188b 100644 --- a/ext/curses/curses.c +++ b/ext/curses/curses.c @@ -2768,20 +2768,22 @@ Init_curses(void) rb_define_module_function(mCurses, "def_prog_mode", curses_def_prog_mode, 0); rb_define_module_function(mCurses, "reset_prog_mode", curses_reset_prog_mode, 0); + { + VALUE version; #if defined(HAVE_FUNC_CURSES_VERSION) - /* ncurses and PDcurses */ - rb_define_const(mCurses, "VERSION", rb_str_new2(curses_version())); + /* ncurses and PDcurses */ + version = rb_str_new2(curses_version()); #elif defined(HAVE_VAR_CURSES_VERSION) - { /* SVR4 curses has an undocumented and undeclared variable, curses_version. * It contains a string, "SVR4". */ RUBY_EXTERN char *curses_version; - rb_define_const(mCurses, "VERSION", rb_sprintf("curses (%s)", curses_version)); - } + version = rb_sprintf("curses (%s)", curses_version); #else - /* BSD curses, perhaps. NetBSD 5 still use it. */ - rb_define_const(mCurses, "VERSION", rb_str_new2("curses (unknown)")); + /* BSD curses, perhaps. NetBSD 5 still use it. */ + version = rb_str_new2("curses (unknown)"); #endif + rb_define_const(mCurses, "VERSION", version); + } /* * Document-class: Curses::Window |