From: Stefan Metzmacher Date: Thu, 30 Jun 2022 17:30:39 +0000 (+0200) Subject: s3:dbwrap_watch: move db_record and db_watched_record to dbwrap_watched_do_locked() X-Git-Tag: ldb-2.6.1~34 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=39cdcec49c6578430d91c450645de1522fe26c2a;p=thirdparty%2Fsamba.git s3:dbwrap_watch: move db_record and db_watched_record to dbwrap_watched_do_locked() This will help in the next commits. BUG: https://bugzilla.samba.org/show_bug.cgi?id=15125 Signed-off-by: Stefan Metzmacher Reviewed-by: Jeremy Allison Reviewed-by: Ralph Boehme --- diff --git a/source3/lib/dbwrap/dbwrap_watch.c b/source3/lib/dbwrap/dbwrap_watch.c index 6fbf305f0a5..d5baf500180 100644 --- a/source3/lib/dbwrap/dbwrap_watch.c +++ b/source3/lib/dbwrap/dbwrap_watch.c @@ -377,6 +377,8 @@ static int db_watched_record_destructor(struct db_watched_record *wrec) struct dbwrap_watched_do_locked_state { struct db_context *db; struct messaging_context *msg_ctx; + struct db_watched_record *wrec; + struct db_record *rec; void (*fn)(struct db_record *rec, TDB_DATA value, void *private_data); @@ -391,16 +393,14 @@ static void dbwrap_watched_do_locked_fn( { struct dbwrap_watched_do_locked_state *state = (struct dbwrap_watched_do_locked_state *)private_data; - struct db_watched_record wrec; - struct db_record rec; db_watched_record_init(state->db, state->msg_ctx, - &rec, &wrec, + state->rec, state->wrec, backend_rec, backend_value); - state->fn(&rec, rec.value, state->private_data); + state->fn(state->rec, state->rec->value, state->private_data); - db_watched_record_fini(&wrec); + db_watched_record_fini(state->wrec); } static NTSTATUS dbwrap_watched_do_locked(struct db_context *db, TDB_DATA key, @@ -411,8 +411,11 @@ static NTSTATUS dbwrap_watched_do_locked(struct db_context *db, TDB_DATA key, { struct db_watched_ctx *ctx = talloc_get_type_abort( db->private_data, struct db_watched_ctx); + struct db_watched_record wrec; + struct db_record rec; struct dbwrap_watched_do_locked_state state = { .db = db, .msg_ctx = ctx->msg, + .rec = &rec, .wrec = &wrec, .fn = fn, .private_data = private_data, }; NTSTATUS status;