lib/tdb2: fix -Wshadow warnings.
authorRusty Russell <rusty@rustcorp.com.au>
Thu, 22 Mar 2012 00:17:27 +0000 (10:47 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Thu, 22 Mar 2012 00:57:38 +0000 (01:57 +0100)
These warnings clutter things up, even though they're of marginal
utility.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
lib/tdb2/check.c
lib/tdb2/free.c
lib/tdb2/test/api-82-lockattr.c
lib/tdb2/test/run-15-append.c
lib/tdb2/test/run-56-open-during-transaction.c
lib/tdb2/test/run-tdb_errorstr.c

index 6ad1ebd362afed4f282e861fe61c4e988448fb62..9fe60e5409d24fbf951b2fb6cc455d93f7c911e1 100644 (file)
@@ -84,7 +84,7 @@ static enum TDB_ERROR check_header(struct tdb_context *tdb, tdb_off_t *recovery,
 
        for (off = hdr.capabilities; off && ecode == TDB_SUCCESS; off = next) {
                const struct tdb_capability *cap;
-               enum TDB_ERROR err;
+               enum TDB_ERROR e;
 
                cap = tdb_access_read(tdb, off, sizeof(*cap), true);
                if (TDB_PTR_IS_ERR(cap)) {
@@ -92,11 +92,11 @@ static enum TDB_ERROR check_header(struct tdb_context *tdb, tdb_off_t *recovery,
                }
 
                /* All capabilities are unknown. */
-               err = unknown_capability(tdb, "tdb_check", cap->type);
+               e = unknown_capability(tdb, "tdb_check", cap->type);
                next = cap->next;
                tdb_access_release(tdb, cap);
-               if (err)
-                       return err;
+               if (e)
+                       return e;
                (*num_capabilities)++;
        }
 
index a6d4c7a4c734e7a52725d8f302d9f052f1ed8cb3..0868a6ea3019d56ebf70f10f14df449affb9ff75 100644 (file)
@@ -585,7 +585,7 @@ unlock_err:
 enum TDB_ERROR add_free_record(struct tdb_context *tdb,
                               tdb_off_t off, tdb_len_t len_with_header,
                               enum tdb_lock_flags waitflag,
-                              bool coalesce)
+                              bool coalesce_ok)
 {
        tdb_off_t b_off;
        tdb_len_t len;
@@ -601,11 +601,11 @@ enum TDB_ERROR add_free_record(struct tdb_context *tdb,
                return ecode;
        }
 
-       ecode = enqueue_in_free(tdb, b_off, off, len, &coalesce);
+       ecode = enqueue_in_free(tdb, b_off, off, len, &coalesce_ok);
        check_list(tdb, b_off);
 
        /* Coalescing unlocks free list. */
-       if (!ecode && coalesce)
+       if (!ecode && coalesce_ok)
                ecode = coalesce_list(tdb, tdb->tdb2.ftable_off, b_off, 2);
        else
                tdb_unlock_free_bucket(tdb, b_off);
index 4a68702fe114e54e8aaeb3503a1a21ae1e33fdc8..8dc4e2fa4ed064841691e55d8518f0e10ea1baf0 100644 (file)
@@ -35,9 +35,9 @@ static int mylock(int fd, int rw, off_t off, off_t len, bool waitflag,
 }
 
 static int trav_err;
-static int trav(struct tdb_context *tdb, TDB_DATA k, TDB_DATA d, int *err)
+static int trav(struct tdb_context *tdb, TDB_DATA k, TDB_DATA d, int *terr)
 {
-       *err = trav_err;
+       *terr = trav_err;
        return 0;
 }
 
index 53fe66bcf7818a9a57bba48d99fd3c4157af909d..8102d3967d95a8d774b4f894d44db46bd89d5527 100644 (file)
@@ -9,7 +9,7 @@
 static tdb_off_t tdb_offset(struct tdb_context *tdb, struct tdb_data key)
 {
        tdb_off_t off;
-       struct tdb_used_record rec;
+       struct tdb_used_record urec;
        struct hash_info h;
 
        if (tdb_get_flags(tdb) & TDB_VERSION1) {
@@ -18,7 +18,7 @@ static tdb_off_t tdb_offset(struct tdb_context *tdb, struct tdb_data key)
                                 &rec);
        }
 
-       off = find_and_lock(tdb, key, F_RDLCK, &h, &rec, NULL);
+       off = find_and_lock(tdb, key, F_RDLCK, &h, &urec, NULL);
        if (TDB_OFF_IS_ERR(off))
                return 0;
        tdb_unlock_hashes(tdb, h.hlock_start, h.hlock_range, F_RDLCK);
index d2115f63cb3612b80575eaf90e2bcdd17c37541d..1ac970119f8d281d49df20b8c6d2aa4b1eb21718 100644 (file)
@@ -44,14 +44,14 @@ static bool is_same(const char *snapshot, const char *latest, off_t len)
 static bool compare_file(int fd, const char *snapshot, off_t snapshot_len)
 {
        char *contents;
-       bool same;
+       bool ret;
 
        /* over-length read serves as length check. */
        contents = malloc(snapshot_len+1);
-       same = pread(fd, contents, snapshot_len+1, 0) == snapshot_len
+       ret = pread(fd, contents, snapshot_len+1, 0) == snapshot_len
                && is_same(snapshot, contents, snapshot_len);
        free(contents);
-       return same;
+       return ret;
 }
 
 static void check_file_intact(int fd)
index 94aab89d323eb7390bea3ddd4bbaf0fc48c46b56..7a2da251aa15b522acf937d50b46615c346e2c24 100644 (file)
@@ -3,50 +3,50 @@
 
 int main(int argc, char *argv[])
 {
-       enum TDB_ERROR err;
+       enum TDB_ERROR e;
        plan_tests(TDB_ERR_RDONLY*-1 + 2);
 
-       for (err = TDB_SUCCESS; err >= TDB_ERR_RDONLY; err--) {
-               switch (err) {
+       for (e = TDB_SUCCESS; e >= TDB_ERR_RDONLY; e--) {
+               switch (e) {
                case TDB_SUCCESS:
-                       ok1(!strcmp(tdb_errorstr(err),
+                       ok1(!strcmp(tdb_errorstr(e),
                                    "Success"));
                        break;
                case TDB_ERR_IO:
-                       ok1(!strcmp(tdb_errorstr(err),
+                       ok1(!strcmp(tdb_errorstr(e),
                                    "IO Error"));
                        break;
                case TDB_ERR_LOCK:
-                       ok1(!strcmp(tdb_errorstr(err),
+                       ok1(!strcmp(tdb_errorstr(e),
                                    "Locking error"));
                        break;
                case TDB_ERR_OOM:
-                       ok1(!strcmp(tdb_errorstr(err),
+                       ok1(!strcmp(tdb_errorstr(e),
                                    "Out of memory"));
                        break;
                case TDB_ERR_EXISTS:
-                       ok1(!strcmp(tdb_errorstr(err),
+                       ok1(!strcmp(tdb_errorstr(e),
                                    "Record exists"));
                        break;
                case TDB_ERR_EINVAL:
-                       ok1(!strcmp(tdb_errorstr(err),
+                       ok1(!strcmp(tdb_errorstr(e),
                                    "Invalid parameter"));
                        break;
                case TDB_ERR_NOEXIST:
-                       ok1(!strcmp(tdb_errorstr(err),
+                       ok1(!strcmp(tdb_errorstr(e),
                                    "Record does not exist"));
                        break;
                case TDB_ERR_RDONLY:
-                       ok1(!strcmp(tdb_errorstr(err),
+                       ok1(!strcmp(tdb_errorstr(e),
                                    "write not permitted"));
                        break;
                case TDB_ERR_CORRUPT:
-                       ok1(!strcmp(tdb_errorstr(err),
+                       ok1(!strcmp(tdb_errorstr(e),
                                    "Corrupt database"));
                        break;
                }
        }
-       ok1(!strcmp(tdb_errorstr(err), "Invalid error code"));
+       ok1(!strcmp(tdb_errorstr(e), "Invalid error code"));
 
        return exit_status();
 }