idmap_tdb: Avoid a few casts
authorVolker Lendecke <vl@samba.org>
Sun, 8 Jan 2017 13:00:39 +0000 (13:00 +0000)
committerUri Simchoni <uri@samba.org>
Wed, 22 Mar 2017 06:11:10 +0000 (07:11 +0100)
The times of attempting to be C++ compatible are gone since C compilers
can do very good warnings too.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Uri Simchoni <uri@samba.org>
source3/winbindd/idmap_tdb_common.c

index 0d7e734cd5ddf52b1a16830f3890a13ecfb17469..e873b60bd8f0ad132deb6f190151f0ddbc707097 100644 (file)
@@ -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"));