summaryrefslogtreecommitdiff
path: root/ext/dbm
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-25 02:09:22 (GMT)
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-02-25 02:09:22 (GMT)
commitd9adb03dd902c1cf7e5fadc8320dccec0ef73139 (patch)
tree0ff85b8779d48f548f71c2c08e5ac7343778b59d /ext/dbm
parentaa281e75179caa27228a0051efb94d14f7c553e4 (diff)
* ext/curses/curses.c (Init_curses): use rb_define_const once for
Curses::VERSION. * ext/dbm/dbm.c (Init_dbm): ditto for DBM::VERSION. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34799 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/dbm')
-rw-r--r--ext/dbm/dbm.c34
1 files changed, 18 insertions, 16 deletions
diff --git a/ext/dbm/dbm.c b/ext/dbm/dbm.c
index f220d3e..e0640d9 100644
--- a/ext/dbm/dbm.c
+++ b/ext/dbm/dbm.c
@@ -1085,36 +1085,38 @@ Init_dbm(void)
*/
rb_define_const(rb_cDBM, "NEWDB", INT2FIX(O_RDWR|O_CREAT|O_TRUNC|RUBY_DBM_RW_BIT));
+ {
+ VALUE version;
#if defined(_DBM_IOERR)
- rb_define_const(rb_cDBM, "VERSION", rb_str_new2("ndbm (4.3BSD)"));
+ version = rb_str_new2("ndbm (4.3BSD)");
#elif defined(RUBYDBM_GDBM_HEADER)
# if defined(HAVE_DECLARED_LIBVAR_GDBM_VERSION)
- /* since gdbm 1.9 */
- rb_define_const(rb_cDBM, "VERSION", rb_str_new2(gdbm_version));
+ /* since gdbm 1.9 */
+ version = rb_str_new2(gdbm_version);
# elif defined(HAVE_UNDECLARED_LIBVAR_GDBM_VERSION)
- /* ndbm.h doesn't declare gdbm_version until gdbm 1.8.3.
- * See extconf.rb for more information. */
- {
- RUBY_EXTERN char *gdbm_version;
- rb_define_const(rb_cDBM, "VERSION", rb_str_new2(gdbm_version));
- }
+ /* ndbm.h doesn't declare gdbm_version until gdbm 1.8.3.
+ * See extconf.rb for more information. */
+ RUBY_EXTERN char *gdbm_version;
+ version = rb_str_new2(gdbm_version);
# else
- rb_define_const(rb_cDBM, "VERSION", rb_str_new2("GDBM (unknown)"));
+ version = rb_str_new2("GDBM (unknown)");
# endif
#elif defined(RUBYDBM_DB_HEADER)
# if defined(HAVE_DB_VERSION)
- /* The version of the dbm library, if using Berkeley DB */
- rb_define_const(rb_cDBM, "VERSION", rb_str_new2(db_version(NULL, NULL, NULL)));
+ /* The version of the dbm library, if using Berkeley DB */
+ version = rb_str_new2(db_version(NULL, NULL, NULL));
# else
- rb_define_const(rb_cDBM, "VERSION", rb_str_new2("Berkeley DB (unknown)"));
+ version = rb_str_new2("Berkeley DB (unknown)");
# endif
#elif defined(_RELIC_H)
# if defined(HAVE_DPVERSION)
- rb_define_const(rb_cDBM, "VERSION", rb_sprintf("QDBM %s", dpversion));
+ version = rb_sprintf("QDBM %s", dpversion);
# else
- rb_define_const(rb_cDBM, "VERSION", rb_str_new2("QDBM (unknown)"));
+ version = rb_str_new2("QDBM (unknown)");
# endif
#else
- rb_define_const(rb_cDBM, "VERSION", rb_str_new2("ndbm (unknown)"));
+ version = rb_str_new2("ndbm (unknown)");
#endif
+ rb_define_const(rb_cDBM, "VERSION", version);
+ }
}