[PATCH 1/4] server: Don't check the user data for NULL in async_terminate().

Zebediah Figura zfigura at codeweavers.com
Mon Jul 5 11:19:59 CDT 2021


This semantically reverts 481517178ff7dd542966d7f11f3d61b3fc8a0776.

That commit was used to implement NtFlushBuffersFile, which at the time didn't
use a callback function. 9050b58f0769fca75c4cebed7be3cce51989814e changed it to
use irp_completion(), since the result of a blocking flush needed to be taken
from the IOSB.

As of 97afac469fbe012e22acc1f1045c88b1004a241f that's not true anymore, but on
the other hand it is theoretically possible for a device driver to touch the
Information member of the IOSB, and we don't seem to lose anything by making
all asyncs take a common path.

Since all asyncs pass user data and there's no clear reason for them not to,
let's get rid of a bit of extra code complexity that's no longer used.

Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
 server/async.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/server/async.c b/server/async.c
index 4dedb27f3d8..0425e4eddf7 100644
--- a/server/async.c
+++ b/server/async.c
@@ -161,18 +161,14 @@ void async_terminate( struct async *async, unsigned int status )
 
     if (!async->direct_result)
     {
-        if (async->data.user)
-        {
-            apc_call_t data;
+        apc_call_t data;
 
-            memset( &data, 0, sizeof(data) );
-            data.type            = APC_ASYNC_IO;
-            data.async_io.user   = async->data.user;
-            data.async_io.sb     = async->data.iosb;
-            data.async_io.status = status;
-            thread_queue_apc( async->thread->process, async->thread, &async->obj, &data );
-        }
-        else async_set_result( &async->obj, STATUS_SUCCESS, 0 );
+        memset( &data, 0, sizeof(data) );
+        data.type            = APC_ASYNC_IO;
+        data.async_io.user   = async->data.user;
+        data.async_io.sb     = async->data.iosb;
+        data.async_io.status = status;
+        thread_queue_apc( async->thread->process, async->thread, &async->obj, &data );
     }
 
     async_reselect( async );
-- 
2.30.2




More information about the wine-devel mailing list