tdb2: allow multiple chain locks.
[ccan] / ccan / tdb2 / tdb.c
index 0fbe90f60996104cedd738a026d0b19599445361..18cf2e93a598ea7c3f742bcb3e445a5985686d55 100644 (file)
@@ -38,7 +38,7 @@ static enum TDB_ERROR replace_data(struct tdb_context *tdb,
 
        /* We didn't like the existing one: remove it. */
        if (old_off) {
-               add_stat(tdb, frees, 1);
+               tdb->stats.frees++;
                ecode = add_free_record(tdb, old_off,
                                        sizeof(struct tdb_used_record)
                                        + key.dsize + old_room);
@@ -285,7 +285,7 @@ enum TDB_ERROR tdb_delete(struct tdb_context *tdb, struct tdb_data key)
        }
 
        /* Free the deleted entry. */
-       add_stat(tdb, frees, 1);
+       tdb->stats.frees++;
        ecode = add_free_record(tdb, off,
                                sizeof(struct tdb_used_record)
                                + rec_key_length(&rec)
@@ -406,11 +406,11 @@ enum TDB_ERROR COLD tdb_logerr(struct tdb_context *tdb,
        va_end(ap);
 
        if (len < 0) {
-               tdb->log_fn(tdb, TDB_LOG_ERROR, tdb->log_data,
-                           "out of memory formatting message:");
-               tdb->log_fn(tdb, level, tdb->log_data, fmt);
+               tdb->log_fn(tdb, TDB_LOG_ERROR,
+                           "out of memory formatting message:", tdb->log_data);
+               tdb->log_fn(tdb, level, fmt, tdb->log_data);
        } else {
-               tdb->log_fn(tdb, level, tdb->log_data, message);
+               tdb->log_fn(tdb, level, message, tdb->log_data);
                free(message);
        }
        errno = saved_errno;