* page-level routines
*/
-#ifndef lint
-static char rcsid[] = "$Id: pair.c,v 1.10 90/12/13 13:00:35 oz Exp $";
-#endif
-
#include "config.h"
+#ifdef __CYGWIN__
+# define EXTCONST extern const
+#else
+# include "EXTERN.h"
+#endif
#include "sdbm.h"
#include "tune.h"
#include "pair.h"
*/
int
-fitpair(pag, need)
-char *pag;
-int need;
+fitpair(char *pag, int need)
{
register int n;
register int off;
}
void
-putpair(pag, key, val)
-char *pag;
-datum key;
-datum val;
+putpair(char *pag, datum key, datum val)
{
register int n;
register int off;
}
datum
-getpair(pag, key)
-char *pag;
-datum key;
+getpair(char *pag, datum key)
{
register int i;
register int n;
return val;
}
+int
+exipair(char *pag, datum key)
+{
+ register short *ino = (short *) pag;
+
+ if (ino[0] == 0)
+ return 0;
+
+ return (seepair(pag, ino[0], key.dptr, key.dsize) != 0);
+}
+
#ifdef SEEDUPS
int
-duppair(pag, key)
-char *pag;
-datum key;
+duppair(char *pag, datum key)
{
register short *ino = (short *) pag;
return ino[0] > 0 && seepair(pag, ino[0], key.dptr, key.dsize) > 0;
#endif
datum
-getnkey(pag, num)
-char *pag;
-int num;
+getnkey(char *pag, int num)
{
datum key;
register int off;
}
int
-delpair(pag, key)
-char *pag;
-datum key;
+delpair(char *pag, datum key)
{
register int n;
register int i;
* return 0 if not found.
*/
static int
-seepair(pag, n, key, siz)
-char *pag;
-register int n;
-register char *key;
-register int siz;
+seepair(char *pag, register int n, register char *key, register int siz)
{
register int i;
register int off = PBLKSIZ;
}
void
-splpage(pag, new, sbit)
-char *pag;
-char *new;
-long sbit;
+splpage(char *pag, char *New, long int sbit)
{
datum key;
datum val;
(void) memcpy(cur, pag, PBLKSIZ);
(void) memset(pag, 0, PBLKSIZ);
- (void) memset(new, 0, PBLKSIZ);
+ (void) memset(New, 0, PBLKSIZ);
n = ino[0];
for (ino++; n > 0; ino += 2) {
/*
* select the page pointer (by looking at sbit) and insert
*/
- (void) putpair((exhash(key) & sbit) ? new : pag, key, val);
+ (void) putpair((exhash(key) & sbit) ? New : pag, key, val);
off = ino[1];
n -= 2;
}
debug(("%d split %d/%d\n", ((short *) cur)[0] / 2,
- ((short *) new)[0] / 2,
+ ((short *) New)[0] / 2,
((short *) pag)[0] / 2));
}
* this could be made more rigorous.
*/
int
-chkpage(pag)
-char *pag;
+chkpage(char *pag)
{
register int n;
register int off;