Fix "may be used uninitialized" warnings in db2 code, even though all
authorKen Raeburn <raeburn@mit.edu>
Mon, 5 Sep 2011 01:22:03 +0000 (01:22 +0000)
committerKen Raeburn <raeburn@mit.edu>
Mon, 5 Sep 2011 01:22:03 +0000 (01:22 +0000)
such cases appear to be safe.  This will permit making
uninitialized-variable messages fatal.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25147 dc483132-0cff-0310-8789-dd5450dbe970

src/plugins/kdb/db2/libdb2/btree/bt_delete.c
src/plugins/kdb/db2/libdb2/btree/bt_search.c
src/plugins/kdb/db2/libdb2/btree/bt_seq.c
src/plugins/kdb/db2/libdb2/btree/bt_split.c
src/plugins/kdb/db2/libdb2/hash/hash_page.c
src/plugins/kdb/db2/libdb2/recno/rec_open.c

index 02ae2e9be655936f075ad3298e2a6009572ca5ad..4133aa3f0b1d30a03728ea15d9acd660a2cd6e7b 100644 (file)
@@ -150,7 +150,7 @@ __bt_stkacq(t, hp, c)
        EPG *e;
        EPGNO *parent;
        PAGE *h;
-       indx_t idx;
+       indx_t idx = 0;
        db_pgno_t pgno;
        recno_t nextpg, prevpg;
        int exact, level;
index de7ab126f9ac8daf227cbe5a874cabffb67373ff..1f4f7160d5d1aa6ad14331be8f2b505e060e80b4 100644 (file)
@@ -157,7 +157,7 @@ __bt_snext(t, h, key, exactp)
        BINTERNAL *bi;
        EPG e;
        EPGNO *parent;
-       indx_t idx;
+       indx_t idx = 0;
        db_pgno_t pgno;
        int level;
 
@@ -237,7 +237,7 @@ __bt_sprev(t, h, key, exactp)
        BINTERNAL *bi;
        EPG e;
        EPGNO *parent;
-       indx_t idx;
+       indx_t idx = 0;
        db_pgno_t pgno;
        int level;
 
index 6124f968bff29b2580ff23cee873e801ff5cd523..5707cab9ba19297f41b22a0a4e6e16a41f973391 100644 (file)
@@ -269,7 +269,7 @@ __bt_seqadv(t, ep, flags)
 {
        CURSOR *c;
        PAGE *h;
-       indx_t idx;
+       indx_t idx = 0;
        db_pgno_t pg;
        int exact, rval;
 
@@ -818,7 +818,7 @@ bt_rseqadv(t, ep, rc, flags)
 {
        CURSOR *c;
        PAGE *h;
-       indx_t idx;
+       indx_t idx = 0;
        db_pgno_t pg;
        int status;
        EPGNO *e;
index 9b2708e760ec84864dde054d6c757e9d30823f96..2460aa54f83bb7ca4634cd5c815651310122e817 100644 (file)
@@ -87,14 +87,14 @@ __bt_split(t, sp, key, data, flags, ilen, argskip)
        size_t ilen;
        u_int32_t argskip;
 {
-       BINTERNAL *bi;
-       BLEAF *bl, *tbl;
+       BINTERNAL *bi = NULL;
+       BLEAF *bl = NULL, *tbl;
        DBT a, b;
        EPGNO *parent;
        PAGE *h, *l, *r, *lchild, *rchild;
        indx_t nxtindex;
        u_int16_t skip;
-       u_int32_t n, nbytes, nksize;
+       u_int32_t n, nbytes, nksize = 0;
        int parentsplit;
        char *dest;
 
@@ -637,6 +637,7 @@ bt_psplit(t, h, l, r, pskip, ilen)
        full = t->bt_psize - BTDATAOFF;
        half = full / 2;
        used = 0;
+       src = NULL;          /* silence gcc "uninitialized" warning */
        for (nxt = off = 0, top = NEXTINDEX(h); nxt < top; ++off) {
                if (skip == off) {
                        nbytes = ilen;
index 5841e92b5fb1646930194818355ffe0203b5f486..86ba7ba28528233822ed9b77fc7c8ccdd91308ea 100644 (file)
@@ -1093,6 +1093,7 @@ overflow_page(hashp)
         * before being set, however, this loop will ALWAYS get executed
         * at least once, so freep is guaranteed to be set.
         */
+       freep = NULL;
        first_page = hashp->hdr.last_freed >> (hashp->hdr.bshift + BYTE_SHIFT);
        for (i = first_page; i <= free_page; i++) {
                if (!(freep = fetch_bitmap(hashp, i)))
index cb971ed3dbe825263f7664efd45a1d491cc9517b..d8b26e70114984faccfe1b93a4c9b69aabdc4778 100644 (file)
@@ -65,7 +65,7 @@ __rec_open(fname, flags, mode, openinfo, dflags)
        DB *dbp;
        PAGE *h;
        struct stat sb;
-       int rfd, sverrno;
+       int rfd = -1, sverrno;
 
        /* Open the user's file -- if this fails, we're done. */
        if (fname != NULL && (rfd = open(fname, flags | O_BINARY, mode)) < 0)