[PATCH] Small cleanup

Volker Lendecke vl at samba.org
Tue Mar 21 10:22:29 UTC 2017


Hi!

Review appreciated!

Thanks, Volker
-------------- next part --------------
>From e966a2af2efde92aca3ce7fbebf1a81a120a6c1b Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Sun, 8 Jan 2017 13:00:39 +0000
Subject: [PATCH] idmap_tdb: Avoid a few casts

The C++ compatibility efforts have ceased to exist since
we got better compiler warnings even from C compilers

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 source3/winbindd/idmap_tdb_common.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/source3/winbindd/idmap_tdb_common.c b/source3/winbindd/idmap_tdb_common.c
index 0d7e734..e873b60 100644
--- a/source3/winbindd/idmap_tdb_common.c
+++ b/source3/winbindd/idmap_tdb_common.c
@@ -51,11 +51,9 @@ static NTSTATUS idmap_tdb_common_allocate_id_action(struct db_context *db,
 						    void *private_data)
 {
 	NTSTATUS ret;
-	struct idmap_tdb_common_allocate_id_context *state;
+	struct idmap_tdb_common_allocate_id_context *state = private_data;
 	uint32_t hwm;
 
-	state = (struct idmap_tdb_common_allocate_id_context *)private_data;
-
 	ret = dbwrap_fetch_uint32_bystring(db, state->hwmkey, &hwm);
 	if (!NT_STATUS_IS_OK(ret)) {
 		ret = NT_STATUS_INTERNAL_DB_ERROR;
@@ -180,11 +178,9 @@ static NTSTATUS idmap_tdb_common_set_mapping_action(struct db_context *db,
 {
 	TDB_DATA data;
 	NTSTATUS ret;
-	struct idmap_tdb_common_set_mapping_context *state;
+	struct idmap_tdb_common_set_mapping_context *state = private_data;
 	TALLOC_CTX *tmp_ctx = talloc_stackframe();
 
-	state = (struct idmap_tdb_common_set_mapping_context *)private_data;
-
 	DEBUG(10, ("Storing %s <-> %s map\n", state->ksidstr, state->kidstr));
 
 	/* check whether sid mapping is already present in db */
@@ -546,12 +542,10 @@ struct idmap_tdb_common_sids_to_unixids_context {
 static NTSTATUS idmap_tdb_common_sids_to_unixids_action(struct db_context *db,
 							void *private_data)
 {
-	struct idmap_tdb_common_sids_to_unixids_context *state;
+	struct idmap_tdb_common_sids_to_unixids_context *state = private_data;
 	int i, num_mapped = 0;
 	NTSTATUS ret = NT_STATUS_OK;
 
-	state = (struct idmap_tdb_common_sids_to_unixids_context *)private_data;
-
 	DEBUG(10, ("idmap_tdb_common_sids_to_unixids: "
 		   " domain: [%s], allocate: %s\n",
 		   state->dom->name, state->allocate_unmapped ? "yes" : "no"));
-- 
2.1.4



More information about the samba-technical mailing list