From 4ea9f8d4c0d08343910d85f44eebdd2d7bff6571 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Thu, 22 Mar 2012 10:47:27 +1030 Subject: lib/tdb2: fix -Wshadow warnings. These warnings clutter things up, even though they're of marginal utility. Signed-off-by: Rusty Russell --- lib/tdb2/check.c | 8 ++++---- lib/tdb2/free.c | 6 +++--- lib/tdb2/test/api-82-lockattr.c | 4 ++-- lib/tdb2/test/run-15-append.c | 4 ++-- lib/tdb2/test/run-56-open-during-transaction.c | 6 +++--- lib/tdb2/test/run-tdb_errorstr.c | 26 +++++++++++++------------- 6 files changed, 27 insertions(+), 27 deletions(-) diff --git a/lib/tdb2/check.c b/lib/tdb2/check.c index 6ad1ebd362..9fe60e5409 100644 --- a/lib/tdb2/check.c +++ b/lib/tdb2/check.c @@ -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)++; } diff --git a/lib/tdb2/free.c b/lib/tdb2/free.c index a6d4c7a4c7..0868a6ea30 100644 --- a/lib/tdb2/free.c +++ b/lib/tdb2/free.c @@ -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); diff --git a/lib/tdb2/test/api-82-lockattr.c b/lib/tdb2/test/api-82-lockattr.c index 4a68702fe1..8dc4e2fa4e 100644 --- a/lib/tdb2/test/api-82-lockattr.c +++ b/lib/tdb2/test/api-82-lockattr.c @@ -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; } diff --git a/lib/tdb2/test/run-15-append.c b/lib/tdb2/test/run-15-append.c index 53fe66bcf7..8102d3967d 100644 --- a/lib/tdb2/test/run-15-append.c +++ b/lib/tdb2/test/run-15-append.c @@ -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); diff --git a/lib/tdb2/test/run-56-open-during-transaction.c b/lib/tdb2/test/run-56-open-during-transaction.c index d2115f63cb..1ac970119f 100644 --- a/lib/tdb2/test/run-56-open-during-transaction.c +++ b/lib/tdb2/test/run-56-open-during-transaction.c @@ -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) diff --git a/lib/tdb2/test/run-tdb_errorstr.c b/lib/tdb2/test/run-tdb_errorstr.c index 94aab89d32..7a2da251aa 100644 --- a/lib/tdb2/test/run-tdb_errorstr.c +++ b/lib/tdb2/test/run-tdb_errorstr.c @@ -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(); } -- cgit