Fix typos in comment from FreeMiNT's db1 patches.diff -r1.1 -r1.2 pkgsrc/pkgtools/libnbcompat/files/db/btree/bt_seq.c
(ryoon)
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: bt_seq.c,v 1.1 2008/10/10 00:21:43 joerg Exp $ */ | 1 | /* $NetBSD: bt_seq.c,v 1.2 2013/09/08 12:02:03 ryoon Exp $ */ | |
2 | /* NetBSD: bt_seq.c,v 1.17 2008/09/11 12:58:00 joerg Exp */ | 2 | /* NetBSD: bt_seq.c,v 1.17 2008/09/11 12:58:00 joerg Exp */ | |
3 | 3 | |||
4 | /*- | 4 | /*- | |
5 | * Copyright (c) 1990, 1993, 1994 | 5 | * Copyright (c) 1990, 1993, 1994 | |
6 | * The Regents of the University of California. All rights reserved. | 6 | * The Regents of the University of California. All rights reserved. | |
7 | * | 7 | * | |
8 | * This code is derived from software contributed to Berkeley by | 8 | * This code is derived from software contributed to Berkeley by | |
9 | * Mike Olson. | 9 | * Mike Olson. | |
10 | * | 10 | * | |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without | |
12 | * modification, are permitted provided that the following conditions | 12 | * modification, are permitted provided that the following conditions | |
13 | * are met: | 13 | * are met: | |
14 | * 1. Redistributions of source code must retain the above copyright | 14 | * 1. Redistributions of source code must retain the above copyright | |
@@ -26,27 +26,27 @@ | @@ -26,27 +26,27 @@ | |||
26 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 26 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
27 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 27 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
28 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 28 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
29 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 29 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
30 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 30 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
33 | * SUCH DAMAGE. | 33 | * SUCH DAMAGE. | |
34 | */ | 34 | */ | |
35 | 35 | |||
36 | #include <nbcompat.h> | 36 | #include <nbcompat.h> | |
37 | #include <nbcompat/cdefs.h> | 37 | #include <nbcompat/cdefs.h> | |
38 | 38 | |||
39 | __RCSID("$NetBSD: bt_seq.c,v 1.1 2008/10/10 00:21:43 joerg Exp $"); | 39 | __RCSID("$NetBSD: bt_seq.c,v 1.2 2013/09/08 12:02:03 ryoon Exp $"); | |
40 | 40 | |||
41 | #include <sys/types.h> | 41 | #include <sys/types.h> | |
42 | 42 | |||
43 | #include <assert.h> | 43 | #include <assert.h> | |
44 | #include <errno.h> | 44 | #include <errno.h> | |
45 | #include <stddef.h> | 45 | #include <stddef.h> | |
46 | #include <stdio.h> | 46 | #include <stdio.h> | |
47 | #include <stdlib.h> | 47 | #include <stdlib.h> | |
48 | 48 | |||
49 | #include <nbcompat/db.h> | 49 | #include <nbcompat/db.h> | |
50 | #include "btree.h" | 50 | #include "btree.h" | |
51 | 51 | |||
52 | static int __bt_first(BTREE *, const DBT *, EPG *, int *); | 52 | static int __bt_first(BTREE *, const DBT *, EPG *, int *); | |
@@ -80,27 +80,27 @@ __bt_seq(const DB *dbp, DBT *key, DBT *d | @@ -80,27 +80,27 @@ __bt_seq(const DB *dbp, DBT *key, DBT *d | |||
80 | BTREE *t; | 80 | BTREE *t; | |
81 | EPG e; | 81 | EPG e; | |
82 | int status; | 82 | int status; | |
83 | 83 | |||
84 | t = dbp->internal; | 84 | t = dbp->internal; | |
85 | 85 | |||
86 | /* Toss any page pinned across calls. */ | 86 | /* Toss any page pinned across calls. */ | |
87 | if (t->bt_pinned != NULL) { | 87 | if (t->bt_pinned != NULL) { | |
88 | mpool_put(t->bt_mp, t->bt_pinned, 0); | 88 | mpool_put(t->bt_mp, t->bt_pinned, 0); | |
89 | t->bt_pinned = NULL; | 89 | t->bt_pinned = NULL; | |
90 | } | 90 | } | |
91 | 91 | |||
92 | /* | 92 | /* | |
93 | * If scan unitialized as yet, or starting at a specific record, set | 93 | * If scan uninitialized as yet, or starting at a specific record, set | |
94 | * the scan to a specific key. Both __bt_seqset and __bt_seqadv pin | 94 | * the scan to a specific key. Both __bt_seqset and __bt_seqadv pin | |
95 | * the page the cursor references if they're successful. | 95 | * the page the cursor references if they're successful. | |
96 | */ | 96 | */ | |
97 | switch (flags) { | 97 | switch (flags) { | |
98 | case R_NEXT: | 98 | case R_NEXT: | |
99 | case R_PREV: | 99 | case R_PREV: | |
100 | if (F_ISSET(&t->bt_cursor, CURS_INIT)) { | 100 | if (F_ISSET(&t->bt_cursor, CURS_INIT)) { | |
101 | status = __bt_seqadv(t, &e, (int)flags); | 101 | status = __bt_seqadv(t, &e, (int)flags); | |
102 | break; | 102 | break; | |
103 | } | 103 | } | |
104 | /* FALLTHROUGH */ | 104 | /* FALLTHROUGH */ | |
105 | case R_FIRST: | 105 | case R_FIRST: | |
106 | case R_LAST: | 106 | case R_LAST: |
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: bt_utils.c,v 1.1 2008/10/10 00:21:43 joerg Exp $ */ | 1 | /* $NetBSD: bt_utils.c,v 1.2 2013/09/08 12:02:03 ryoon Exp $ */ | |
2 | /* NetBSD: bt_utils.c,v 1.13 2008/09/10 17:52:35 joerg Exp */ | 2 | /* NetBSD: bt_utils.c,v 1.13 2008/09/10 17:52:35 joerg Exp */ | |
3 | 3 | |||
4 | /*- | 4 | /*- | |
5 | * Copyright (c) 1990, 1993, 1994 | 5 | * Copyright (c) 1990, 1993, 1994 | |
6 | * The Regents of the University of California. All rights reserved. | 6 | * The Regents of the University of California. All rights reserved. | |
7 | * | 7 | * | |
8 | * This code is derived from software contributed to Berkeley by | 8 | * This code is derived from software contributed to Berkeley by | |
9 | * Mike Olson. | 9 | * Mike Olson. | |
10 | * | 10 | * | |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without | |
12 | * modification, are permitted provided that the following conditions | 12 | * modification, are permitted provided that the following conditions | |
13 | * are met: | 13 | * are met: | |
14 | * 1. Redistributions of source code must retain the above copyright | 14 | * 1. Redistributions of source code must retain the above copyright | |
@@ -26,27 +26,27 @@ | @@ -26,27 +26,27 @@ | |||
26 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 26 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
27 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 27 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
28 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 28 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
29 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 29 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
30 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 30 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
33 | * SUCH DAMAGE. | 33 | * SUCH DAMAGE. | |
34 | */ | 34 | */ | |
35 | 35 | |||
36 | #include <nbcompat.h> | 36 | #include <nbcompat.h> | |
37 | #include <nbcompat/cdefs.h> | 37 | #include <nbcompat/cdefs.h> | |
38 | 38 | |||
39 | __RCSID("$NetBSD: bt_utils.c,v 1.1 2008/10/10 00:21:43 joerg Exp $"); | 39 | __RCSID("$NetBSD: bt_utils.c,v 1.2 2013/09/08 12:02:03 ryoon Exp $"); | |
40 | 40 | |||
41 | #include <sys/param.h> | 41 | #include <sys/param.h> | |
42 | 42 | |||
43 | #include <assert.h> | 43 | #include <assert.h> | |
44 | #include <stdio.h> | 44 | #include <stdio.h> | |
45 | #include <stdlib.h> | 45 | #include <stdlib.h> | |
46 | #include <string.h> | 46 | #include <string.h> | |
47 | 47 | |||
48 | #include <nbcompat/db.h> | 48 | #include <nbcompat/db.h> | |
49 | #include "btree.h" | 49 | #include "btree.h" | |
50 | 50 | |||
51 | /* | 51 | /* | |
52 | * __bt_ret -- | 52 | * __bt_ret -- | |
@@ -63,27 +63,27 @@ __RCSID("$NetBSD: bt_utils.c,v 1.1 2008/ | @@ -63,27 +63,27 @@ __RCSID("$NetBSD: bt_utils.c,v 1.1 2008/ | |||
63 | * | 63 | * | |
64 | * Returns: | 64 | * Returns: | |
65 | * RET_SUCCESS, RET_ERROR. | 65 | * RET_SUCCESS, RET_ERROR. | |
66 | */ | 66 | */ | |
67 | int | 67 | int | |
68 | __bt_ret(BTREE *t, EPG *e, DBT *key, DBT *rkey, DBT *data, DBT *rdata, int copy) | 68 | __bt_ret(BTREE *t, EPG *e, DBT *key, DBT *rkey, DBT *data, DBT *rdata, int copy) | |
69 | { | 69 | { | |
70 | BLEAF *bl; | 70 | BLEAF *bl; | |
71 | void *p; | 71 | void *p; | |
72 | 72 | |||
73 | bl = GETBLEAF(e->page, e->index); | 73 | bl = GETBLEAF(e->page, e->index); | |
74 | 74 | |||
75 | /* | 75 | /* | |
76 | * We must copy big keys/data to make them contigous. Otherwise, | 76 | * We must copy big keys/data to make them contiguous. Otherwise, | |
77 | * leave the page pinned and don't copy unless the user specified | 77 | * leave the page pinned and don't copy unless the user specified | |
78 | * concurrent access. | 78 | * concurrent access. | |
79 | */ | 79 | */ | |
80 | if (key == NULL) | 80 | if (key == NULL) | |
81 | goto dataonly; | 81 | goto dataonly; | |
82 | 82 | |||
83 | if (bl->flags & P_BIGKEY) { | 83 | if (bl->flags & P_BIGKEY) { | |
84 | if (__ovfl_get(t, bl->bytes, | 84 | if (__ovfl_get(t, bl->bytes, | |
85 | &key->size, &rkey->data, &rkey->size)) | 85 | &key->size, &rkey->data, &rkey->size)) | |
86 | return (RET_ERROR); | 86 | return (RET_ERROR); | |
87 | key->data = rkey->data; | 87 | key->data = rkey->data; | |
88 | } else if (copy || F_ISSET(t, B_DB_LOCK)) { | 88 | } else if (copy || F_ISSET(t, B_DB_LOCK)) { | |
89 | if (bl->ksize > rkey->size) { | 89 | if (bl->ksize > rkey->size) { |
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: btree.h,v 1.3 2008/10/28 15:06:26 joerg Exp $ */ | 1 | /* $NetBSD: btree.h,v 1.4 2013/09/08 12:02:03 ryoon Exp $ */ | |
2 | /* NetBSD: btree.h,v 1.16 2008/08/26 21:18:38 joerg Exp */ | 2 | /* NetBSD: btree.h,v 1.16 2008/08/26 21:18:38 joerg Exp */ | |
3 | 3 | |||
4 | /*- | 4 | /*- | |
5 | * Copyright (c) 1991, 1993, 1994 | 5 | * Copyright (c) 1991, 1993, 1994 | |
6 | * The Regents of the University of California. All rights reserved. | 6 | * The Regents of the University of California. All rights reserved. | |
7 | * | 7 | * | |
8 | * This code is derived from software contributed to Berkeley by | 8 | * This code is derived from software contributed to Berkeley by | |
9 | * Mike Olson. | 9 | * Mike Olson. | |
10 | * | 10 | * | |
11 | * Redistribution and use in source and binary forms, with or without | 11 | * Redistribution and use in source and binary forms, with or without | |
12 | * modification, are permitted provided that the following conditions | 12 | * modification, are permitted provided that the following conditions | |
13 | * are met: | 13 | * are met: | |
14 | * 1. Redistributions of source code must retain the above copyright | 14 | * 1. Redistributions of source code must retain the above copyright | |
@@ -176,27 +176,27 @@ NBINTERNAL(uint32_t len) { | @@ -176,27 +176,27 @@ NBINTERNAL(uint32_t len) { | |||
176 | typedef struct _rinternal { | 176 | typedef struct _rinternal { | |
177 | recno_t nrecs; /* number of records */ | 177 | recno_t nrecs; /* number of records */ | |
178 | pgno_t pgno; /* page number stored below */ | 178 | pgno_t pgno; /* page number stored below */ | |
179 | } RINTERNAL; | 179 | } RINTERNAL; | |
180 | 180 | |||
181 | /* Get the page's RINTERNAL structure at index indx. */ | 181 | /* Get the page's RINTERNAL structure at index indx. */ | |
182 | #define GETRINTERNAL(pg, indx) \ | 182 | #define GETRINTERNAL(pg, indx) \ | |
183 | ((RINTERNAL *)(void *)((char *)(void *)(pg) + (pg)->linp[indx])) | 183 | ((RINTERNAL *)(void *)((char *)(void *)(pg) + (pg)->linp[indx])) | |
184 | 184 | |||
185 | /* Get the number of bytes in the entry. */ | 185 | /* Get the number of bytes in the entry. */ | |
186 | #define NRINTERNAL \ | 186 | #define NRINTERNAL \ | |
187 | BTLALIGN(sizeof(recno_t) + sizeof(pgno_t)) | 187 | BTLALIGN(sizeof(recno_t) + sizeof(pgno_t)) | |
188 | 188 | |||
189 | /* Copy a RINTERAL entry to the page. */ | 189 | /* Copy a RINTERNAL entry to the page. */ | |
190 | #define WR_RINTERNAL(p, nrecs, pgno) do { \ | 190 | #define WR_RINTERNAL(p, nrecs, pgno) do { \ | |
191 | *(recno_t *)(void *)p = nrecs; \ | 191 | *(recno_t *)(void *)p = nrecs; \ | |
192 | p += sizeof(recno_t); \ | 192 | p += sizeof(recno_t); \ | |
193 | *(pgno_t *)(void *)p = pgno; \ | 193 | *(pgno_t *)(void *)p = pgno; \ | |
194 | } while (/*CONSTCOND*/0) | 194 | } while (/*CONSTCOND*/0) | |
195 | 195 | |||
196 | /* For the btree leaf pages, the item is a key and data pair. */ | 196 | /* For the btree leaf pages, the item is a key and data pair. */ | |
197 | typedef struct _bleaf { | 197 | typedef struct _bleaf { | |
198 | uint32_t ksize; /* size of key */ | 198 | uint32_t ksize; /* size of key */ | |
199 | uint32_t dsize; /* size of data */ | 199 | uint32_t dsize; /* size of data */ | |
200 | uint8_t flags; /* P_BIGDATA, P_BIGKEY */ | 200 | uint8_t flags; /* P_BIGDATA, P_BIGKEY */ | |
201 | char bytes[1]; /* data */ | 201 | char bytes[1]; /* data */ | |
202 | } BLEAF; | 202 | } BLEAF; |