home *** CD-ROM | disk | FTP | other *** search
- *** ../ddb.old/Makefile Thu Nov 18 00:08:26 1993
- --- Makefile Wed Nov 17 23:53:07 1993
- ***************
- *** 1,5 ****
- OPT=-O
- ! CFLAGS=$(OPT) -I.
- CDBS=hash.c list.c queue.c stack.c binary.c bit.c
- CSRCS=new.c $(CDBS)
- COBJS=$(CSRCS:.c=.o)
- --- 1,5 ----
- OPT=-O
- ! CFLAGS=$(OPT)
- CDBS=hash.c list.c queue.c stack.c binary.c bit.c
- CSRCS=new.c $(CDBS)
- COBJS=$(CSRCS:.c=.o)
- *** ../ddb.old/binary.c Thu Nov 18 00:08:27 1993
- --- binary.c Thu Nov 18 00:01:03 1993
- ***************
- *** 21,27 ****
- #include <stdlib.h>
- #include <string.h>
- #include <sys/types.h>
- ! #include <ddb.h>
-
- #define MIN(a,b) ((a) < (b) ? (a) : (b))
-
- --- 21,28 ----
- #include <stdlib.h>
- #include <string.h>
- #include <sys/types.h>
- ! #include <errno.h>
- ! #include "ddb.h"
-
- #define MIN(a,b) ((a) < (b) ? (a) : (b))
-
- ***************
- *** 48,53 ****
- --- 49,56 ----
-
- extern void *ddb_new(const DATUM *, const DATUM *, size_t);
-
- + extern int errno;
- +
- int
- ddb_memcmp(const DATUM *dp1, const DATUM *dp2)
- {
- ***************
- *** 65,71 ****
- static int
- validbd(int bd)
- {
- ! return binary && bd < maxbinaries && binary[bd].used;
- }
-
- static int
- --- 68,78 ----
- static int
- validbd(int bd)
- {
- ! int valid = binary && bd < maxbinaries && binary[bd].used;
- !
- ! if (!valid)
- ! errno = EBADF;
- ! return valid;
- }
-
- static int
- ***************
- *** 77,82 ****
- --- 84,90 ----
- case DDB_DUPLICATE:
- return 1;
- default:
- + errno = EINVAL;
- return 0;
- }
- }
- ***************
- *** 167,172 ****
- --- 175,181 ----
- bp->left = bp_new;
- } else /* DDB_INSERT */ {
- bfree(bp_new);
- + errno = EEXIST;
- return -1;
- }
- } else
- ***************
- *** 191,198 ****
- if (bp = find(bd, key, cmp, NULL))
- #endif
- return &bp->data;
- ! else
- return NULL;
- }
-
- int
- --- 200,209 ----
- if (bp = find(bd, key, cmp, NULL))
- #endif
- return &bp->data;
- ! else {
- ! errno = ENOENT;
- return NULL;
- + }
- }
-
- int
- ***************
- *** 206,212 ****
- #endif
-
- if (!validbd(bd))
- ! return NULL;
- if (!cmp)
- cmp = ddb_memcmp;
-
- --- 217,223 ----
- #endif
-
- if (!validbd(bd))
- ! return -1;
- if (!cmp)
- cmp = ddb_memcmp;
-
- ***************
- *** 254,261 ****
- free(bp);
- }
- return 0;
- ! } else
- return -1;
- }
-
- static void
- --- 265,274 ----
- free(bp);
- }
- return 0;
- ! } else {
- ! errno = ENOENT;
- return -1;
- + }
- }
-
- static void
- ***************
- *** 385,422 ****
- {
- if (validbd(bd))
- recurse(binary[bd].root, f, order);
- - }
- -
- - DATUM *
- - ddb_blargestkey(int bd)
- - {
- - BELEM *bp;
- -
- - if (!validbd(bd))
- - return NULL;
- -
- - if (bp = binary[bd].root) {
- - while (bp->right)
- - bp = bp->right;
- - return &bp->key;
- - } else
- - return NULL;
- - }
- -
- - DATUM *
- - ddb_bsmallestkey(int bd)
- - {
- - BELEM *bp;
- -
- - if (!validbd(bd))
- - return NULL;
- -
- - if (bp = binary[bd].root) {
- - while (bp->left)
- - bp = bp->left;
- - return &bp->key;
- - } else
- - return NULL;
- }
-
- #ifdef DEBUG
- --- 398,403 ----
- *** ../ddb.old/bit.c Thu Nov 18 00:08:27 1993
- --- bit.c Thu Nov 18 00:07:35 1993
- ***************
- *** 20,26 ****
- #include <string.h>
- #include <limits.h>
- #include <sys/types.h>
- ! #include <ddb.h>
-
- #define MIN(a,b) ((a) < (b) ? (a) : (b))
-
- --- 20,27 ----
- #include <string.h>
- #include <limits.h>
- #include <sys/types.h>
- ! #include <errno.h>
- ! #include "ddb.h"
-
- #define MIN(a,b) ((a) < (b) ? (a) : (b))
-
- ***************
- *** 42,54 ****
- static BIT *vector = NULL;
- static int maxvectors = 0;
-
- ! #define CHECK_MAXBIT 1
-
- static int
- ! validbd(int bd, unsigned long bit, int check)
- {
- ! return vector && bd < maxvectors && vector[bd].used
- ! && (check != CHECK_MAXBIT || bit <= vector[bd].maxbit);
- }
-
- static int
- --- 43,58 ----
- static BIT *vector = NULL;
- static int maxvectors = 0;
-
- ! extern int errno;
-
- static int
- ! validbd(int bd)
- {
- ! int valid = vector && bd < maxvectors && vector[bd].used;
- !
- ! if (!valid)
- ! errno = EBADF;
- ! return valid;
- }
-
- static int
- ***************
- *** 60,65 ****
- --- 64,70 ----
- case DDB_DUPLICATE:
- return 1;
- default:
- + errno = EINVAL;
- return 0;
- }
- }
- ***************
- *** 71,78 ****
- unsigned long nints1, nints2;
- unsigned long bit;
-
- ! if (maxbit > (unsigned long)LONG_MAX)
- return -1;
-
- nints1 = vector[bd].maxbit / WORD_BIT + 1;
- nints2 = maxbit / WORD_BIT + 1;
- --- 76,85 ----
- unsigned long nints1, nints2;
- unsigned long bit;
-
- ! if (maxbit > (unsigned long)LONG_MAX) {
- ! errno = EDOM;
- return -1;
- + }
-
- nints1 = vector[bd].maxbit / WORD_BIT + 1;
- nints2 = maxbit / WORD_BIT + 1;
- ***************
- *** 94,100 ****
- int
- ddb_bitwrite(int bd, unsigned long bit, int mode)
- {
- ! if (!validbd(bd, bit, !CHECK_MAXBIT) || !validmode(mode))
- return -1;
- if (bit > vector[bd].maxbit && enlarge(bd, bit) == -1)
- return -1;
- --- 101,107 ----
- int
- ddb_bitwrite(int bd, unsigned long bit, int mode)
- {
- ! if (!validbd(bd) || !validmode(mode))
- return -1;
- if (bit > vector[bd].maxbit && enlarge(bd, bit) == -1)
- return -1;
- ***************
- *** 101,108 ****
-
- if (!isset(vector[bd].bits, bit))
- setbit(vector[bd].bits, bit);
- ! else if (mode & DDB_INSERT)
- return -1;
-
- return 0;
- }
- --- 108,117 ----
-
- if (!isset(vector[bd].bits, bit))
- setbit(vector[bd].bits, bit);
- ! else if (mode & DDB_INSERT) {
- ! errno = EEXIST;
- return -1;
- + }
-
- return 0;
- }
- ***************
- *** 110,140 ****
- int
- ddb_bitread(int bd, unsigned long bit)
- {
- ! if (!validbd(bd, bit, !CHECK_MAXBIT))
- return -1;
-
- ! if (bit > vector[bd].maxbit)
- return 0;
- - return isset(vector[bd].bits, bit) != 0;
- }
-
- int
- ddb_bitdelete(int bd, unsigned long bit)
- {
- ! if (!validbd(bd, bit, CHECK_MAXBIT))
- return -1;
- !
- ! if (isset(vector[bd].bits, bit)) {
- clrbit(vector[bd].bits, bit);
- return 0;
- ! } else
- ! return -1;
- }
-
- int
- ddb_bitclose(int bd)
- {
- ! if (!validbd(bd, 0, !CHECK_MAXBIT))
- return -1;
-
- vector[bd].used = 0;
- --- 119,152 ----
- int
- ddb_bitread(int bd, unsigned long bit)
- {
- ! if (!validbd(bd))
- return -1;
-
- ! if (bit > vector[bd].maxbit || !isset(vector[bd].bits, bit)) {
- ! errno = ENOENT;
- ! return -1;
- ! } else
- return 0;
- }
-
- int
- ddb_bitdelete(int bd, unsigned long bit)
- {
- ! if (!validbd(bd))
- return -1;
- ! if (bit > vector[bd].maxbit || !isset(vector[bd].bits, bit)) {
- ! errno = ENOENT;
- ! return -1;
- ! } else {
- clrbit(vector[bd].bits, bit);
- return 0;
- ! }
- }
-
- int
- ddb_bitclose(int bd)
- {
- ! if (!validbd(bd))
- return -1;
-
- vector[bd].used = 0;
- ***************
- *** 147,153 ****
- int
- ddb_bitset(int bd, int on)
- {
- ! if (!validbd(bd, 0, !CHECK_MAXBIT))
- return -1;
-
- (void)memset(vector[bd].bits, on ? ~0 : '\0',
- --- 159,165 ----
- int
- ddb_bitset(int bd, int on)
- {
- ! if (!validbd(bd))
- return -1;
-
- (void)memset(vector[bd].bits, on ? ~0 : '\0',
- ***************
- *** 164,171 ****
- int j;
- BIT *vtmp;
-
- ! if (maxbit > (unsigned long)LONG_MAX)
- return -1;
-
- for (i = 0; i < maxvectors && vector[i].used; i++)
- ;
- --- 176,185 ----
- int j;
- BIT *vtmp;
-
- ! if (maxbit > (unsigned long)LONG_MAX) {
- ! errno = EDOM;
- return -1;
- + }
-
- for (i = 0; i < maxvectors && vector[i].used; i++)
- ;
- ***************
- *** 243,250 ****
- {
- unsigned long index;
-
- ! if (!validbd(bd, 0, !CHECK_MAXBIT) || (index = findword(vector[bd].bits,
- ! 0, vector[bd].maxbit / WORD_BIT, 0)) == -1)
- return -1;
- else
- return vector[bd].lastbit = findlowset(vector[bd].bits[index],
- --- 257,264 ----
- {
- unsigned long index;
-
- ! if (!validbd(bd) || (index = findword(vector[bd].bits, 0,
- ! vector[bd].maxbit / WORD_BIT, 0)) == -1)
- return -1;
- else
- return vector[bd].lastbit = findlowset(vector[bd].bits[index],
- ***************
- *** 259,265 ****
- unsigned int mask;
- unsigned long index;
-
- ! if (!validbd(bd, 0, !CHECK_MAXBIT))
- return -1;
- mask = wordmask(vector[bd].lastbit % WORD_BIT);
- if ((index = findword(vector[bd].bits, vector[bd].lastbit / WORD_BIT,
- --- 273,279 ----
- unsigned int mask;
- unsigned long index;
-
- ! if (!validbd(bd))
- return -1;
- mask = wordmask(vector[bd].lastbit % WORD_BIT);
- if ((index = findword(vector[bd].bits, vector[bd].lastbit / WORD_BIT,
- *** ../ddb.old/ddb.3 Thu Nov 18 00:08:27 1993
- --- ddb.3 Wed Nov 17 23:53:08 1993
- ***************
- *** 126,145 ****
- .BR write(\|)
- functions use to add to the databases.
- Must include only one of the following values:
- ! .IP DDB_INSERT
- Insert the pair only if the key is not currently in the database.
- ! .IP DDB_REPLACE
- Add the pair to the database.
- If the key is already in the database, delete that entry.
- ! .IP DDB_DUPLICATE
- Add the pair to the database.
- If the key is already in the database, do not delete that entry.
- !
- For the
- .BR ddb_lwrite(\|)
- ! function, the value
- ! .IR DDB_TAIL
- ! can be inclusively OR'ed into
- .IR flag
- to specify writing at the tail of the list.
- .IP \fIf\fP
- --- 126,145 ----
- .BR write(\|)
- functions use to add to the databases.
- Must include only one of the following values:
- ! .RS
- ! .IP DDB_INSERT 14
- Insert the pair only if the key is not currently in the database.
- ! .IP DDB_REPLACE 14
- Add the pair to the database.
- If the key is already in the database, delete that entry.
- ! .IP DDB_DUPLICATE 14
- Add the pair to the database.
- If the key is already in the database, do not delete that entry.
- ! .RE
- ! .IP
- For the
- .BR ddb_lwrite(\|)
- ! function, the value DDB_TAIL can be inclusively OR'ed into
- .IR flag
- to specify writing at the tail of the list.
- .IP \fIf\fP
- ***************
- *** 229,240 ****
- functions.
- .LP
- Functions returning type pointer\-to\-DATUM return NULL on failure.
- ! .SH NOTES
- ! All of the
- .BR read(\|)
- ! functions except
- ! .BR ddb_bitread(\|)
- ! return pointers to memory which should be freed when unneeded.
- .LP
- Altering a database and then calling a
- .BR next(\|)
- --- 229,329 ----
- functions.
- .LP
- Functions returning type pointer\-to\-DATUM return NULL on failure.
- ! .SH ERRORS
- ! .LP
- ! If an
- ! .BR open(\|)
- ! function fails, errno will be set to one of the following values:
- ! .IP [ENOMEM] 9
- ! Sufficient memory could not be allocated.
- ! .IP [EDOM] 9
- ! .BR ddb_bitopen(\|)
- ! has been called with
- ! .IR maxbit
- ! larger than LONG_MAX.
- ! .LP
- ! If a
- ! .BR close(\|)
- ! function fails, errno will be set to
- ! .IP [EBADF] 9
- ! The
- ! .IR dbd
- ! argument is not a valid database descriptor.
- ! .LP
- ! If a
- .BR read(\|)
- ! function fails, errno may be set to one of the following values:
- ! .IP [EBADF] 9
- ! The
- ! .IR dbd
- ! argument is not a valid database descriptor.
- ! .IP [ENOENT] 9
- ! The
- ! .IR key
- ! argument does not specify an entry in the database.
- ! .LP
- ! Errno is not changed when the relevant database is empty
- ! and
- ! .BR ddb_lread(\|)
- ! is called with
- ! .IR key
- ! NULL or
- ! .BR ddb_qread(\|)
- ! or
- ! .BR ddb_sread(\|)
- ! are called.
- ! .LP
- ! If a
- ! .BR write(\|)
- ! function fails, errno will be set to one of the following values:
- ! .IP [EBADF] 9
- ! The
- ! .IR dbd
- ! argument is not a valid database descriptor.
- ! .IP [EINVAL] 9
- ! The
- ! .IR flag
- ! argument is not valid.
- ! .IP [EEXIST] 9
- ! The entry indicated by
- ! .IR key
- ! is already present in the database and DDB_INSERT was specified.
- ! .IP [ENOMEM] 9
- ! Sufficient memory could not be allocated.
- ! .IP [EDOM] 9
- ! .BR ddb_bitwrite(\|)
- ! has been called with
- ! .IR bit
- ! larger than LONG_MAX.
- ! .LP
- ! If a
- ! .BR delete(\|)
- ! function fails, errno will be set to one of the following values:
- ! .IP [EBADF] 9
- ! The
- ! .IR dbd
- ! argument is not a valid database descriptor.
- ! .IP [ENOENT] 9
- ! The
- ! .IR key
- ! argument does not specify an entry in the database.
- ! .LP
- ! When the
- ! .BR first(\|)
- ! and
- ! .BR next(\|)
- ! functions fail because the all of the entries in a database have
- ! been returned, errno is not changed.
- ! However, they can fail with errno set to
- ! .IP [EBADF] 9
- ! The
- ! .IR dbd
- ! argument is not a valid database descriptor.
- ! .SH NOTES
- ! The
- ! .BR ddb_qread(\|)
- ! function
- ! returns a pointer to memory which should be freed when unneeded.
- .LP
- Altering a database and then calling a
- .BR next(\|)
- *** ../ddb.old/ddb.h Thu Nov 18 00:08:27 1993
- --- ddb.h Wed Nov 17 23:53:08 1993
- ***************
- *** 46,53 ****
- extern DATUM *ddb_bfirst(int);
- extern DATUM *ddb_bnext(int);
- extern void ddb_bfunc(int, void (*)(const DATUM *, const DATUM *), int);
- - extern DATUM *ddb_blargestkey(int);
- - extern DATUM *ddb_bsmallestkey(int);
- #ifdef DEBUG
- extern void ddb_bdump(int, void (*)(const DATUM *), void (*)(const DATUM *),
- int);
- --- 46,51 ----
- ***************
- *** 61,68 ****
- extern int ddb_bitread(int, unsigned long);
- extern long ddb_bitfirst(int);
- extern long ddb_bitnext(int);
- - extern long ddb_bitlargestkey(int);
- - extern long ddb_bitsmallestkey(int);
- extern int ddb_bitset(int, int);
- #ifdef DEBUG
- extern void ddb_bitdump(int);
- --- 59,64 ----
- *** ../ddb.old/hash.c Thu Nov 18 00:08:28 1993
- --- hash.c Wed Nov 17 23:53:08 1993
- ***************
- *** 19,25 ****
- #include <stdlib.h>
- #include <string.h>
- #include <sys/types.h>
- ! #include <ddb.h>
-
- typedef struct hashent {
- DATUM key;
- --- 19,26 ----
- #include <stdlib.h>
- #include <string.h>
- #include <sys/types.h>
- ! #include <errno.h>
- ! #include "ddb.h"
-
- typedef struct hashent {
- DATUM key;
- ***************
- *** 46,51 ****
- --- 47,54 ----
- extern void *ddb_new(const DATUM *, const DATUM *, size_t);
- extern int ddb_memcmp(const DATUM *, const DATUM *);
-
- + extern int errno;
- +
- static size_t
- def_hash(const char *key, size_t keysize, size_t nbuckets)
- {
- ***************
- *** 60,66 ****
- static int
- validhd(int hd)
- {
- ! return hashtable && hd < maxtables && hashtable[hd].used;
- }
-
- static DATUM *
- --- 63,73 ----
- static int
- validhd(int hd)
- {
- ! int valid = hashtable && hd < maxtables && hashtable[hd].used;
- !
- ! if (!valid)
- ! errno = EBADF;
- ! return valid;
- }
-
- static DATUM *
- ***************
- *** 88,100 ****
- }
-
- if (action == H_READ)
- ! return ptr ? &ptr->data : NULL;
-
- ! if (ptr && action == DDB_INSERT)
- return NULL;
-
- ! if (!ptr && action == H_DELETE)
- return NULL;
-
- if (ptr && action != DDB_DUPLICATE) { /* H_DELETE || DDB_REPLACE */
- free(ptr->data.addr);
- --- 95,116 ----
- }
-
- if (action == H_READ)
- ! if (ptr)
- ! return &ptr->data;
- ! else {
- ! errno = ENOENT;
- ! return NULL;
- ! }
-
- ! if (ptr && action == DDB_INSERT) {
- ! errno = EEXIST;
- return NULL;
- + }
-
- ! if (!ptr && action == H_DELETE) {
- ! errno = ENOENT;
- return NULL;
- + }
-
- if (ptr && action != DDB_DUPLICATE) { /* H_DELETE || DDB_REPLACE */
- free(ptr->data.addr);
- ***************
- *** 140,148 ****
- ddb_hwrite(int hd, const DATUM *key, const DATUM *data, ddb_cmp_t cmp, int mode,
- ddb_hash_t hash)
- {
- ! if (mode != DDB_INSERT && mode != DDB_REPLACE && mode != DDB_DUPLICATE)
- return -1;
- ! else if (hashop(hd, mode, key, data, cmp, hash))
- return 0;
- else
- return -1;
- --- 156,166 ----
- ddb_hwrite(int hd, const DATUM *key, const DATUM *data, ddb_cmp_t cmp, int mode,
- ddb_hash_t hash)
- {
- ! if (mode != DDB_INSERT && mode != DDB_REPLACE
- ! && mode != DDB_DUPLICATE) {
- ! errno = EINVAL;
- return -1;
- ! } else if (hashop(hd, mode, key, data, cmp, hash))
- return 0;
- else
- return -1;
- *** ../ddb.old/list.c Thu Nov 18 00:08:28 1993
- --- list.c Wed Nov 17 23:53:08 1993
- ***************
- *** 19,25 ****
- #include <stdlib.h>
- #include <string.h>
- #include <sys/types.h>
- ! #include <ddb.h>
-
- extern void *ddb_new(const DATUM *, const DATUM *, size_t);
- extern int ddb_memcmp(const DATUM *, const DATUM *);
- --- 19,26 ----
- #include <stdlib.h>
- #include <string.h>
- #include <sys/types.h>
- ! #include <errno.h>
- ! #include "ddb.h"
-
- extern void *ddb_new(const DATUM *, const DATUM *, size_t);
- extern int ddb_memcmp(const DATUM *, const DATUM *);
- ***************
- *** 38,47 ****
- static LIST *list = NULL;
- static int maxlists = 0;
-
- static int
- validld(int ld)
- {
- ! return list && ld < maxlists && list[ld].used;
- }
-
- static int
- --- 39,54 ----
- static LIST *list = NULL;
- static int maxlists = 0;
-
- + extern int errno;
- +
- static int
- validld(int ld)
- {
- ! int valid = list && ld < maxlists && list[ld].used;
- !
- ! if (!valid)
- ! errno = EBADF;
- ! return valid;
- }
-
- static int
- ***************
- *** 53,58 ****
- --- 60,66 ----
- case DDB_DUPLICATE:
- return 1;
- default:
- + errno = EINVAL;
- return 0;
- }
- }
- ***************
- *** 99,107 ****
- if (mode & DDB_TAIL)
- (void)find(ld, NULL, cmp, &le_prev);
- } else if (le = find(ld, key, cmp, NULL))
- ! if (mode & DDB_INSERT)
- return -1;
- ! else /* DDB_REPLACE */ {
- free(le->key.addr);
- free(le->data.addr);
- le->key = le_new->key;
- --- 107,116 ----
- if (mode & DDB_TAIL)
- (void)find(ld, NULL, cmp, &le_prev);
- } else if (le = find(ld, key, cmp, NULL))
- ! if (mode & DDB_INSERT) {
- ! errno = EEXIST;
- return -1;
- ! } else /* DDB_REPLACE */ {
- free(le->key.addr);
- free(le->data.addr);
- le->key = le_new->key;
- ***************
- *** 144,149 ****
- --- 153,159 ----
- if (le = find(ld, key, cmp, NULL))
- return &le->data;
-
- + errno = ENOENT;
- return NULL;
- }
-
- ***************
- *** 173,178 ****
- --- 183,189 ----
- return 0;
- }
-
- + errno = ENOENT;
- return -1;
- }
-
- *** ../ddb.old/new.c Thu Nov 18 00:08:28 1993
- --- new.c Wed Nov 17 23:53:08 1993
- ***************
- *** 19,25 ****
- #include <stdlib.h>
- #include <sys/types.h>
- #include <string.h>
- ! #include <ddb.h>
-
- void *
- ddb_new(const DATUM *key, const DATUM *data, size_t size)
- --- 19,25 ----
- #include <stdlib.h>
- #include <sys/types.h>
- #include <string.h>
- ! #include "ddb.h"
-
- void *
- ddb_new(const DATUM *key, const DATUM *data, size_t size)
- *** ../ddb.old/patchlevel.h Thu Nov 18 00:08:28 1993
- --- patchlevel.h Wed Nov 17 23:53:09 1993
- ***************
- *** 1 ****
- ! #define PATCHLEVEL 0
- --- 1 ----
- ! #define PATCHLEVEL 1
- *** ../ddb.old/queue.c Thu Nov 18 00:08:28 1993
- --- queue.c Wed Nov 17 23:53:09 1993
- ***************
- *** 18,24 ****
- #include <stdio.h>
- #include <stdlib.h>
- #include <sys/types.h>
- ! #include <ddb.h>
-
- typedef struct qent {
- DATUM data;
- --- 18,25 ----
- #include <stdio.h>
- #include <stdlib.h>
- #include <sys/types.h>
- ! #include <errno.h>
- ! #include "ddb.h"
-
- typedef struct qent {
- DATUM data;
- ***************
- *** 35,44 ****
-
- extern void *ddb_new(const DATUM *, const DATUM *, size_t);
-
- static int
- validqd(int qd)
- {
- ! return queue && qd < maxqueues && queue[qd].used;
- }
-
- int
- --- 36,51 ----
-
- extern void *ddb_new(const DATUM *, const DATUM *, size_t);
-
- + extern int errno;
- +
- static int
- validqd(int qd)
- {
- ! int valid = queue && qd < maxqueues && queue[qd].used;
- !
- ! if (!valid)
- ! errno = EBADF;
- ! return valid;
- }
-
- int
- *** ../ddb.old/stack.c Thu Nov 18 00:08:29 1993
- --- stack.c Wed Nov 17 23:53:09 1993
- ***************
- *** 18,24 ****
- #include <stdio.h>
- #include <stdlib.h>
- #include <sys/types.h>
- ! #include <ddb.h>
-
- typedef struct {
- int used;
- --- 18,25 ----
- #include <stdio.h>
- #include <stdlib.h>
- #include <sys/types.h>
- ! #include <errno.h>
- ! #include "ddb.h"
-
- typedef struct {
- int used;
- ***************
- *** 31,40 ****
-
- extern void *ddb_new(const DATUM *, const DATUM *, size_t);
-
- static int
- validsd(int sd)
- {
- ! return stack && sd < maxstacks && stack[sd].used;
- }
-
- int
- --- 32,47 ----
-
- extern void *ddb_new(const DATUM *, const DATUM *, size_t);
-
- + extern int errno;
- +
- static int
- validsd(int sd)
- {
- ! int valid = stack && sd < maxstacks && stack[sd].used;
- !
- ! if (!valid)
- ! errno = EBADF;
- ! return valid;
- }
-
- int
-