1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/sdbm/_sdbm.c (SEEDUPS, BADMESS): make settable using command

line options.

* ext/sdbm/_sdbm.c (makroom): suppress unused result warning.

* ext/sdbm/extconf.rb: disable BADMESS, a library should not emit
  messages directly.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29515 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2010-10-16 01:06:13 +00:00
parent 92a7cf0455
commit 7e0920723c
3 changed files with 23 additions and 7 deletions

View file

@ -1,3 +1,13 @@
Sat Oct 16 10:06:08 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/sdbm/_sdbm.c (SEEDUPS, BADMESS): make settable using command
line options.
* ext/sdbm/_sdbm.c (makroom): suppress unused result warning.
* ext/sdbm/extconf.rb: disable BADMESS, a library should not emit
messages directly.
Sat Oct 16 08:39:03 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* dln.c (dln_strerror): get English message first, instead of

View file

@ -39,9 +39,14 @@
* important tuning parms (hah)
*/
#define SEEDUPS /* always detect duplicates */
#define BADMESS /* generate a message for worst case:
#ifndef SEEDUPS
#define SEEDUPS 1 /* always detect duplicates */
#endif
#ifndef BADMESS
#define BADMESS 1 /* generate a message for worst case:
cannot make room after SPLTMAX splits */
#endif
/*
* misc
*/
@ -67,7 +72,7 @@ static int delpair proto((char *, datum));
static int chkpage proto((char *));
static datum getnkey proto((char *, int));
static void splpage proto((char *, char *, long));
#ifdef SEEDUPS
#if SEEDUPS
static int duppair proto((char *, datum));
#endif
@ -302,7 +307,7 @@ sdbm_store(register DBM *db, datum key, datum val, int flags)
*/
if (flags == DBM_REPLACE)
(void) delpair(db->pagbuf, key);
#ifdef SEEDUPS
#if SEEDUPS
else if (duppair(db->pagbuf, key))
return 1;
#endif
@ -421,8 +426,8 @@ makroom(register DBM *db, long int hash, int need)
* if we are here, this is real bad news. After SPLTMAX splits,
* we still cannot fit the key. say goodnight.
*/
#ifdef BADMESS
(void) write(2, "sdbm: cannot insert after SPLTMAX attempts.\n", 44);
#if BADMESS
(void) (write(2, "sdbm: cannot insert after SPLTMAX attempts.\n", 44) < 0);
#endif
return 0;
@ -698,7 +703,7 @@ getpair(char *pag, datum key)
return val;
}
#ifdef SEEDUPS
#if SEEDUPS
static int
duppair(char *pag, datum key)
{

View file

@ -1,3 +1,4 @@
require 'mkmf'
$defs << "-D""BADMESS=0"
create_makefile("sdbm")