dbwrap: Avoid a stackframe in fetch_locked_internal
authorVolker Lendecke <vl@samba.org>
Fri, 6 Dec 2013 11:38:12 +0000 (11:38 +0000)
committerStefan Metzmacher <metze@samba.org>
Sat, 14 Dec 2013 09:08:07 +0000 (10:08 +0100)
This shows in profiles. We call this so often that this is a pretty
hot code path.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
lib/dbwrap/dbwrap.c

index 44e20bce5f48d5b40df895c10c1acea3ba4f05e6..2c633cf159e4515879cf6a949b72b5878ca6d280 100644 (file)
@@ -220,21 +220,18 @@ static struct db_record *dbwrap_fetch_locked_internal(
 {
        struct db_record *rec;
        struct dbwrap_lock_order_state *lock_order;
-       TALLOC_CTX *frame = talloc_stackframe();
 
-       lock_order = dbwrap_check_lock_order(db, frame);
+       lock_order = dbwrap_check_lock_order(db, mem_ctx);
        if (lock_order == NULL) {
-               TALLOC_FREE(frame);
                return NULL;
        }
        rec = db_fn(db, mem_ctx, key);
        if (rec == NULL) {
-               TALLOC_FREE(frame);
+               TALLOC_FREE(lock_order);
                return NULL;
        }
        (void)talloc_steal(rec, lock_order);
        rec->db = db;
-       TALLOC_FREE(frame);
        return rec;
 }