]> git.ozlabs.org Git - ccan/blobdiff - ccan/tdb2/check.c
tdb2: remove extraneous whitespace.
[ccan] / ccan / tdb2 / check.c
index df61184f60822fd0dac8af95a16897f28fb3a772..4cd92b43c040a30c40e4e952e05aac5deb0a13e9 100644 (file)
@@ -1,7 +1,7 @@
- /* 
+ /*
    Trivial Database 2: free list/block handling
    Copyright (C) Rusty Russell 2010
-   
+
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
@@ -277,7 +277,7 @@ static bool check_hash_tree(struct tdb_context *tdb,
 
                        if (is_subhash(group[b])) {
                                uint64_t subprefix;
-                               subprefix = (hprefix 
+                               subprefix = (hprefix
                                     << (group_bits + TDB_HASH_GROUP_BITS))
                                        + g * (1 << TDB_HASH_GROUP_BITS) + b;
 
@@ -449,7 +449,7 @@ static bool check_free(struct tdb_context *tdb,
        }
        return true;
 }
-                      
+
 static bool check_free_table(struct tdb_context *tdb,
                             tdb_off_t ftable_off,
                             unsigned ftable_num,
@@ -603,8 +603,13 @@ static bool check_linear(struct tdb_context *tdb,
                        }
                        /* This record should be in free lists. */
                        if (frec_ftable(&rec.f) != TDB_FTABLE_NONE
-                           && !append(fr, num_free, off))
+                           && !append(fr, num_free, off)) {
+                               tdb_logerr(tdb, TDB_ERR_OOM,
+                                          TDB_DEBUG_ERROR,
+                                          "tdb_check: tracking %zu'th"
+                                          " free record.", *num_free);
                                return false;
+                       }
                } else if (rec_magic(&rec.u) == TDB_USED_MAGIC
                           || rec_magic(&rec.u) == TDB_CHAIN_MAGIC
                           || rec_magic(&rec.u) == TDB_HTABLE_MAGIC
@@ -612,8 +617,13 @@ static bool check_linear(struct tdb_context *tdb,
                        uint64_t klen, dlen, extra;
 
                        /* This record is used! */
-                       if (!append(used, num_used, off))
+                       if (!append(used, num_used, off)) {
+                               tdb_logerr(tdb, TDB_ERR_OOM,
+                                          TDB_DEBUG_ERROR,
+                                          "tdb_check: tracking %zu'th"
+                                          " used record.", *num_used);
                                return false;
+                       }
 
                        klen = rec_key_length(&rec.u);
                        dlen = rec_data_length(&rec.u);