summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEzra Peisach <epeisach@mit.edu>2001-06-21 22:13:14 +0000
committerEzra Peisach <epeisach@mit.edu>2001-06-21 22:13:14 +0000
commitdbf80690a83094fe8a44dc338cc0012daf62d992 (patch)
tree956626ab51d7a9201b888ad834852fd7671d3c59 /src
parentc3c053fae211468b3763a8b98e20de044f0d938e (diff)
downloadkrb5-dbf80690a83094fe8a44dc338cc0012daf62d992.tar.gz
krb5-dbf80690a83094fe8a44dc338cc0012daf62d992.tar.xz
krb5-dbf80690a83094fe8a44dc338cc0012daf62d992.zip
* test/dbtest.c: Cast argument to isspace() to int. Do not shadow
global variables type and flags. * btree/bt_search.c, btree/bt_seq.c, recno/rec_search.c: Change local variable index to idx. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13467 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src')
-rw-r--r--src/util/db2/ChangeLog8
-rw-r--r--src/util/db2/btree/bt_search.c34
-rw-r--r--src/util/db2/btree/bt_seq.c24
-rw-r--r--src/util/db2/recno/rec_search.c14
-rw-r--r--src/util/db2/test/dbtest.c30
5 files changed, 59 insertions, 51 deletions
diff --git a/src/util/db2/ChangeLog b/src/util/db2/ChangeLog
index 9b1c675fc..1aaecfe99 100644
--- a/src/util/db2/ChangeLog
+++ b/src/util/db2/ChangeLog
@@ -1,5 +1,13 @@
2001-06-21 Ezra Peisach <epeisach@mit.edu>
+ * test/dbtest.c: Cast argument to isspace() to int. Do not shadow
+ global variables type and flags.
+
+ * btree/bt_search.c, btree/bt_seq.c, recno/rec_search.c: Change
+ local variable index to idx.
+
+2001-06-21 Ezra Peisach <epeisach@mit.edu>
+
* btree/bt_delete.c, btree/bt_put.c, recno/rec_delete.c,
recno/rec_put.c: Change local variable index to idx.
diff --git a/src/util/db2/btree/bt_search.c b/src/util/db2/btree/bt_search.c
index 869f1ef3f..de7ab126f 100644
--- a/src/util/db2/btree/bt_search.c
+++ b/src/util/db2/btree/bt_search.c
@@ -69,7 +69,7 @@ __bt_search(t, key, exactp)
int *exactp;
{
PAGE *h;
- indx_t base, index, lim;
+ indx_t base, idx, lim;
db_pgno_t pg;
int cmp;
@@ -81,7 +81,7 @@ __bt_search(t, key, exactp)
/* Do a binary search on the current page. */
t->bt_cur.page = h;
for (base = 0, lim = NEXTINDEX(h); lim; lim >>= 1) {
- t->bt_cur.index = index = base + (lim >> 1);
+ t->bt_cur.index = idx = base + (lim >> 1);
if ((cmp = __bt_cmp(t, key, &t->bt_cur)) == 0) {
if (h->flags & P_BLEAF) {
*exactp = 1;
@@ -90,7 +90,7 @@ __bt_search(t, key, exactp)
goto next;
}
if (cmp > 0) {
- base = index + 1;
+ base = idx + 1;
--lim;
}
}
@@ -126,10 +126,10 @@ __bt_search(t, key, exactp)
* be a parent page for the key. If a split later occurs, the
* inserted page will be to the right of the saved page.
*/
- index = base ? base - 1 : base;
+ idx = base ? base - 1 : base;
-next: BT_PUSH(t, h->pgno, index);
- pg = GETBINTERNAL(h, index)->pgno;
+next: BT_PUSH(t, h->pgno, idx);
+ pg = GETBINTERNAL(h, idx)->pgno;
mpool_put(t->bt_mp, h, 0);
}
}
@@ -157,7 +157,7 @@ __bt_snext(t, h, key, exactp)
BINTERNAL *bi;
EPG e;
EPGNO *parent;
- indx_t index;
+ indx_t idx;
db_pgno_t pgno;
int level;
@@ -188,8 +188,8 @@ __bt_snext(t, h, key, exactp)
/* Move to the next index. */
if (parent->index != NEXTINDEX(h) - 1) {
- index = parent->index + 1;
- BT_PUSH(t, h->pgno, index);
+ idx = parent->index + 1;
+ BT_PUSH(t, h->pgno, idx);
break;
}
mpool_put(t->bt_mp, h, 0);
@@ -198,7 +198,7 @@ __bt_snext(t, h, key, exactp)
/* Restore the stack. */
while (level--) {
/* Push the next level down onto the stack. */
- bi = GETBINTERNAL(h, index);
+ bi = GETBINTERNAL(h, idx);
pgno = bi->pgno;
BT_PUSH(t, pgno, 0);
@@ -208,7 +208,7 @@ __bt_snext(t, h, key, exactp)
/* Get the next level down. */
if ((h = mpool_get(t->bt_mp, pgno, 0)) == NULL)
return (0);
- index = 0;
+ idx = 0;
}
mpool_put(t->bt_mp, h, 0);
return (1);
@@ -237,7 +237,7 @@ __bt_sprev(t, h, key, exactp)
BINTERNAL *bi;
EPG e;
EPGNO *parent;
- indx_t index;
+ indx_t idx;
db_pgno_t pgno;
int level;
@@ -269,8 +269,8 @@ __bt_sprev(t, h, key, exactp)
/* Move to the next index. */
if (parent->index != 0) {
- index = parent->index - 1;
- BT_PUSH(t, h->pgno, index);
+ idx = parent->index - 1;
+ BT_PUSH(t, h->pgno, idx);
break;
}
mpool_put(t->bt_mp, h, 0);
@@ -279,7 +279,7 @@ __bt_sprev(t, h, key, exactp)
/* Restore the stack. */
while (level--) {
/* Push the next level down onto the stack. */
- bi = GETBINTERNAL(h, index);
+ bi = GETBINTERNAL(h, idx);
pgno = bi->pgno;
/* Lose the currently pinned page. */
@@ -289,8 +289,8 @@ __bt_sprev(t, h, key, exactp)
if ((h = mpool_get(t->bt_mp, pgno, 0)) == NULL)
return (1);
- index = NEXTINDEX(h) - 1;
- BT_PUSH(t, pgno, index);
+ idx = NEXTINDEX(h) - 1;
+ BT_PUSH(t, pgno, idx);
}
mpool_put(t->bt_mp, h, 0);
return (1);
diff --git a/src/util/db2/btree/bt_seq.c b/src/util/db2/btree/bt_seq.c
index 3e68c66a9..d3924d862 100644
--- a/src/util/db2/btree/bt_seq.c
+++ b/src/util/db2/btree/bt_seq.c
@@ -244,7 +244,7 @@ __bt_seqadv(t, ep, flags)
{
CURSOR *c;
PAGE *h;
- indx_t index;
+ indx_t idx;
db_pgno_t pg;
int exact, rval;
@@ -312,15 +312,15 @@ __bt_seqadv(t, ep, flags)
*/
if (F_ISSET(c, CURS_AFTER))
goto usecurrent;
- index = c->pg.index;
- if (++index == NEXTINDEX(h)) {
+ idx = c->pg.index;
+ if (++idx == NEXTINDEX(h)) {
pg = h->nextpg;
mpool_put(t->bt_mp, h, 0);
if (pg == P_INVALID)
return (RET_SPECIAL);
if ((h = mpool_get(t->bt_mp, pg, 0)) == NULL)
return (RET_ERROR);
- index = 0;
+ idx = 0;
}
break;
case R_PREV: /* Previous record. */
@@ -335,22 +335,22 @@ usecurrent: F_CLR(c, CURS_AFTER | CURS_BEFORE);
ep->index = c->pg.index;
return (RET_SUCCESS);
}
- index = c->pg.index;
- if (index == 0) {
+ idx = c->pg.index;
+ if (idx == 0) {
pg = h->prevpg;
mpool_put(t->bt_mp, h, 0);
if (pg == P_INVALID)
return (RET_SPECIAL);
if ((h = mpool_get(t->bt_mp, pg, 0)) == NULL)
return (RET_ERROR);
- index = NEXTINDEX(h) - 1;
+ idx = NEXTINDEX(h) - 1;
} else
- --index;
+ --idx;
break;
}
ep->page = h;
- ep->index = index;
+ ep->index = idx;
return (RET_SUCCESS);
}
@@ -470,10 +470,10 @@ __bt_first(t, key, erval, exactp)
* index: page index
*/
void
-__bt_setcur(t, pgno, index)
+__bt_setcur(t, pgno, idx)
BTREE *t;
db_pgno_t pgno;
- u_int index;
+ u_int idx;
{
/* Lose any already deleted key. */
if (t->bt_cursor.key.data != NULL) {
@@ -485,6 +485,6 @@ __bt_setcur(t, pgno, index)
/* Update the cursor. */
t->bt_cursor.pg.pgno = pgno;
- t->bt_cursor.pg.index = index;
+ t->bt_cursor.pg.index = idx;
F_SET(&t->bt_cursor, CURS_INIT);
}
diff --git a/src/util/db2/recno/rec_search.c b/src/util/db2/recno/rec_search.c
index 0be9563b8..a328f1be0 100644
--- a/src/util/db2/recno/rec_search.c
+++ b/src/util/db2/recno/rec_search.c
@@ -66,7 +66,7 @@ __rec_search(t, recno, op)
recno_t recno;
enum SRCHOP op;
{
- register indx_t index;
+ register indx_t idx;
register PAGE *h;
EPGNO *parent;
RINTERNAL *r;
@@ -84,23 +84,23 @@ __rec_search(t, recno, op)
t->bt_cur.index = recno - total;
return (&t->bt_cur);
}
- for (index = 0, top = NEXTINDEX(h);;) {
- r = GETRINTERNAL(h, index);
- if (++index == top || total + r->nrecs > recno)
+ for (idx = 0, top = NEXTINDEX(h);;) {
+ r = GETRINTERNAL(h, idx);
+ if (++idx == top || total + r->nrecs > recno)
break;
total += r->nrecs;
}
- BT_PUSH(t, pg, index - 1);
+ BT_PUSH(t, pg, idx - 1);
pg = r->pgno;
switch (op) {
case SDELETE:
- --GETRINTERNAL(h, (index - 1))->nrecs;
+ --GETRINTERNAL(h, (idx - 1))->nrecs;
mpool_put(t->bt_mp, h, MPOOL_DIRTY);
break;
case SINSERT:
- ++GETRINTERNAL(h, (index - 1))->nrecs;
+ ++GETRINTERNAL(h, (idx - 1))->nrecs;
mpool_put(t->bt_mp, h, MPOOL_DIRTY);
break;
case SEARCH:
diff --git a/src/util/db2/test/dbtest.c b/src/util/db2/test/dbtest.c
index e50afd876..68d0d53fc 100644
--- a/src/util/db2/test/dbtest.c
+++ b/src/util/db2/test/dbtest.c
@@ -177,7 +177,7 @@ main(argc, argv)
/* Delete the newline, displaying the key/data is easier. */
if (ofd == STDOUT_FILENO && (t = strchr(p, '\n')) != NULL)
*t = '\0';
- if ((len = strlen(buf)) == 0 || isspace(*p) || *p == '#')
+ if ((len = strlen(buf)) == 0 || isspace((int) *p) || *p == '#')
continue;
/* Convenient gdb break point. */
@@ -503,17 +503,17 @@ dump(dbp, rev)
int rev;
{
DBT key, data;
- int flags, nflags;
+ int lflags, nflags;
if (rev) {
- flags = R_LAST;
+ lflags = R_LAST;
nflags = R_PREV;
} else {
- flags = R_FIRST;
+ lflags = R_FIRST;
nflags = R_NEXT;
}
- for (;; flags = nflags)
- switch (dbp->seq(dbp, &key, &data, flags)) {
+ for (;; lflags = nflags)
+ switch (dbp->seq(dbp, &key, &data, lflags)) {
case 0:
(void)write(ofd, data.data, data.size);
if (ofd == STDOUT_FILENO)
@@ -535,7 +535,7 @@ setflags(s)
{
char *p;
- for (; isspace(*s); ++s);
+ for (; isspace((int) *s); ++s);
if (*s == '\n' || *s == '\0')
return (0);
if ((p = strchr(s, '\n')) != NULL)
@@ -555,10 +555,10 @@ setflags(s)
}
char *
-sflags(flags)
- int flags;
+sflags(lflags)
+ int lflags;
{
- switch (flags) {
+ switch (lflags) {
case R_CURSOR: return ("R_CURSOR");
case R_FIRST: return ("R_FIRST");
case R_IAFTER: return ("R_IAFTER");
@@ -588,8 +588,8 @@ dbtype(s)
}
void *
-setinfo(type, s)
- DBTYPE type;
+setinfo(db_type, s)
+ DBTYPE db_type;
char *s;
{
static BTREEINFO ib;
@@ -600,10 +600,10 @@ setinfo(type, s)
if ((eq = strchr(s, '=')) == NULL)
err("%s: illegal structure set statement", s);
*eq++ = '\0';
- if (!isdigit(*eq))
+ if (!isdigit((int) *eq))
err("%s: structure set statement must be a number", s);
- switch (type) {
+ switch (db_type) {
case DB_BTREE:
if (!strcmp("flags", s)) {
ib.flags = atoi(eq);
@@ -693,7 +693,7 @@ rfile(name, lenp)
int fd;
char *np;
- for (; isspace(*name); ++name);
+ for (; isspace((int) *name); ++name);
if ((np = strchr(name, '\n')) != NULL)
*np = '\0';
if ((fd = open(name, O_RDONLY, 0)) < 0 ||