[PATCH 5/8] winhttp: Get rid of object_header_t and object_vtbl_t.

Hans Leidekker hans at codeweavers.com
Thu Nov 15 05:38:50 CST 2018


Signed-off-by: Hans Leidekker <hans at codeweavers.com>
---
 dlls/winhttp/handle.c          | 18 +++++++++---------
 dlls/winhttp/session.c         | 40 ++++++++++++++++++++--------------------
 dlls/winhttp/winhttp_private.h | 33 ++++++++++++++++-----------------
 3 files changed, 45 insertions(+), 46 deletions(-)

diff --git a/dlls/winhttp/handle.c b/dlls/winhttp/handle.c
index d08e72079f..b76d8fe8d1 100644
--- a/dlls/winhttp/handle.c
+++ b/dlls/winhttp/handle.c
@@ -42,20 +42,20 @@ static CRITICAL_SECTION_DEBUG handle_cs_debug =
 };
 static CRITICAL_SECTION handle_cs = { &handle_cs_debug, -1, 0, 0, 0, 0 };
 
-static object_header_t **handles;
+static struct object_header **handles;
 static ULONG_PTR next_handle;
 static ULONG_PTR max_handles;
 
-object_header_t *addref_object( object_header_t *hdr )
+struct object_header *addref_object( struct object_header *hdr )
 {
     ULONG refs = InterlockedIncrement( &hdr->refs );
     TRACE("%p -> refcount = %d\n", hdr, refs);
     return hdr;
 }
 
-object_header_t *grab_object( HINTERNET hinternet )
+struct object_header *grab_object( HINTERNET hinternet )
 {
-    object_header_t *hdr = NULL;
+    struct object_header *hdr = NULL;
     ULONG_PTR handle = (ULONG_PTR)hinternet;
 
     EnterCriticalSection( &handle_cs );
@@ -69,7 +69,7 @@ object_header_t *grab_object( HINTERNET hinternet )
     return hdr;
 }
 
-void release_object( object_header_t *hdr )
+void release_object( struct object_header *hdr )
 {
     ULONG refs = InterlockedDecrement( &hdr->refs );
     TRACE("object %p refcount = %d\n", hdr, refs);
@@ -85,9 +85,9 @@ void release_object( object_header_t *hdr )
     }
 }
 
-HINTERNET alloc_handle( object_header_t *hdr )
+HINTERNET alloc_handle( struct object_header *hdr )
 {
-    object_header_t **p;
+    struct object_header **p;
     ULONG_PTR handle, num;
 
     list_init( &hdr->children );
@@ -124,7 +124,7 @@ BOOL free_handle( HINTERNET hinternet )
 {
     BOOL ret = FALSE;
     ULONG_PTR handle = (ULONG_PTR)hinternet;
-    object_header_t *hdr = NULL, *child, *next;
+    struct object_header *hdr = NULL, *child, *next;
 
     EnterCriticalSection( &handle_cs );
 
@@ -144,7 +144,7 @@ BOOL free_handle( HINTERNET hinternet )
 
     if (hdr)
     {
-        LIST_FOR_EACH_ENTRY_SAFE( child, next, &hdr->children, object_header_t, entry )
+        LIST_FOR_EACH_ENTRY_SAFE( child, next, &hdr->children, struct object_header, entry )
         {
             TRACE("freeing child handle %p for parent handle 0x%lx\n", child->handle, handle + 1);
             free_handle( child->handle );
diff --git a/dlls/winhttp/session.c b/dlls/winhttp/session.c
index 93c10e0679..88043462af 100644
--- a/dlls/winhttp/session.c
+++ b/dlls/winhttp/session.c
@@ -64,7 +64,7 @@ DWORD get_last_error( void )
     return GetLastError();
 }
 
-void send_callback( object_header_t *hdr, DWORD status, LPVOID info, DWORD buflen )
+void send_callback( struct object_header *hdr, DWORD status, void *info, DWORD buflen )
 {
     if (hdr->callback && (hdr->notify_mask & status))
     {
@@ -86,7 +86,7 @@ BOOL WINAPI WinHttpCheckPlatform( void )
 /***********************************************************************
  *          session_destroy (internal)
  */
-static void session_destroy( object_header_t *hdr )
+static void session_destroy( struct object_header *hdr )
 {
     session_t *session = (session_t *)hdr;
 
@@ -106,7 +106,7 @@ static void session_destroy( object_header_t *hdr )
     heap_free( session );
 }
 
-static BOOL session_query_option( object_header_t *hdr, DWORD option, LPVOID buffer, LPDWORD buflen )
+static BOOL session_query_option( struct object_header *hdr, DWORD option, void *buffer, DWORD *buflen )
 {
     session_t *session = (session_t *)hdr;
 
@@ -157,7 +157,7 @@ static BOOL session_query_option( object_header_t *hdr, DWORD option, LPVOID buf
     }
 }
 
-static BOOL session_set_option( object_header_t *hdr, DWORD option, LPVOID buffer, DWORD buflen )
+static BOOL session_set_option( struct object_header *hdr, DWORD option, void *buffer, DWORD buflen )
 {
     session_t *session = (session_t *)hdr;
 
@@ -246,7 +246,7 @@ static BOOL session_set_option( object_header_t *hdr, DWORD option, LPVOID buffe
     }
 }
 
-static const object_vtbl_t session_vtbl =
+static const struct object_vtbl session_vtbl =
 {
     session_destroy,
     session_query_option,
@@ -320,7 +320,7 @@ end:
 /***********************************************************************
  *          connect_destroy (internal)
  */
-static void connect_destroy( object_header_t *hdr )
+static void connect_destroy( struct object_header *hdr )
 {
     connect_t *connect = (connect_t *)hdr;
 
@@ -335,7 +335,7 @@ static void connect_destroy( object_header_t *hdr )
     heap_free( connect );
 }
 
-static BOOL connect_query_option( object_header_t *hdr, DWORD option, LPVOID buffer, LPDWORD buflen )
+static BOOL connect_query_option( struct object_header *hdr, DWORD option, void *buffer, DWORD *buflen )
 {
     connect_t *connect = (connect_t *)hdr;
 
@@ -350,7 +350,7 @@ static BOOL connect_query_option( object_header_t *hdr, DWORD option, LPVOID buf
             return FALSE;
         }
 
-        *(HINTERNET *)buffer = ((object_header_t *)connect->session)->handle;
+        *(HINTERNET *)buffer = ((struct object_header *)connect->session)->handle;
         *buflen = sizeof(HINTERNET);
         return TRUE;
     }
@@ -386,7 +386,7 @@ static BOOL connect_query_option( object_header_t *hdr, DWORD option, LPVOID buf
     }
 }
 
-static const object_vtbl_t connect_vtbl =
+static const struct object_vtbl connect_vtbl =
 {
     connect_destroy,
     connect_query_option,
@@ -606,7 +606,7 @@ end:
 /***********************************************************************
  *          request_destroy (internal)
  */
-static void request_destroy( object_header_t *hdr )
+static void request_destroy( struct object_header *hdr )
 {
     request_t *request = (request_t *)hdr;
     unsigned int i, j;
@@ -704,7 +704,7 @@ static BOOL copy_sockaddr( const struct sockaddr *addr, SOCKADDR_STORAGE *addr_s
     }
 }
 
-static BOOL request_query_option( object_header_t *hdr, DWORD option, LPVOID buffer, LPDWORD buflen )
+static BOOL request_query_option( struct object_header *hdr, DWORD option, void *buffer, DWORD *buflen )
 {
     request_t *request = (request_t *)hdr;
 
@@ -885,7 +885,7 @@ static WCHAR *buffer_to_str( WCHAR *buffer, DWORD buflen )
     return NULL;
 }
 
-static BOOL request_set_option( object_header_t *hdr, DWORD option, LPVOID buffer, DWORD buflen )
+static BOOL request_set_option( struct object_header *hdr, DWORD option, void *buffer, DWORD buflen )
 {
     request_t *request = (request_t *)hdr;
 
@@ -1050,7 +1050,7 @@ static BOOL request_set_option( object_header_t *hdr, DWORD option, LPVOID buffe
     }
 }
 
-static const object_vtbl_t request_vtbl =
+static const struct object_vtbl request_vtbl =
 {
     request_destroy,
     request_query_option,
@@ -1186,7 +1186,7 @@ end:
  */
 BOOL WINAPI WinHttpCloseHandle( HINTERNET handle )
 {
-    object_header_t *hdr;
+    struct object_header *hdr;
 
     TRACE("%p\n", handle);
 
@@ -1201,7 +1201,7 @@ BOOL WINAPI WinHttpCloseHandle( HINTERNET handle )
     return TRUE;
 }
 
-static BOOL query_option( object_header_t *hdr, DWORD option, LPVOID buffer, LPDWORD buflen )
+static BOOL query_option( struct object_header *hdr, DWORD option, void *buffer, DWORD *buflen )
 {
     BOOL ret = FALSE;
 
@@ -1245,7 +1245,7 @@ static BOOL query_option( object_header_t *hdr, DWORD option, LPVOID buffer, LPD
 BOOL WINAPI WinHttpQueryOption( HINTERNET handle, DWORD option, LPVOID buffer, LPDWORD buflen )
 {
     BOOL ret = FALSE;
-    object_header_t *hdr;
+    struct object_header *hdr;
 
     TRACE("%p, %u, %p, %p\n", handle, option, buffer, buflen);
 
@@ -1262,7 +1262,7 @@ BOOL WINAPI WinHttpQueryOption( HINTERNET handle, DWORD option, LPVOID buffer, L
     return ret;
 }
 
-static BOOL set_option( object_header_t *hdr, DWORD option, LPVOID buffer, DWORD buflen )
+static BOOL set_option( struct object_header *hdr, DWORD option, void *buffer, DWORD buflen )
 {
     BOOL ret = TRUE;
 
@@ -1304,7 +1304,7 @@ static BOOL set_option( object_header_t *hdr, DWORD option, LPVOID buffer, DWORD
 BOOL WINAPI WinHttpSetOption( HINTERNET handle, DWORD option, LPVOID buffer, DWORD buflen )
 {
     BOOL ret = FALSE;
-    object_header_t *hdr;
+    struct object_header *hdr;
 
     TRACE("%p, %u, %p, %u\n", handle, option, buffer, buflen);
 
@@ -2048,7 +2048,7 @@ BOOL WINAPI WinHttpSetDefaultProxyConfiguration( WINHTTP_PROXY_INFO *info )
 WINHTTP_STATUS_CALLBACK WINAPI WinHttpSetStatusCallback( HINTERNET handle, WINHTTP_STATUS_CALLBACK callback,
                                                          DWORD flags, DWORD_PTR reserved )
 {
-    object_header_t *hdr;
+    struct object_header *hdr;
     WINHTTP_STATUS_CALLBACK ret;
 
     TRACE("%p, %p, 0x%08x, 0x%lx\n", handle, callback, flags, reserved);
@@ -2073,7 +2073,7 @@ WINHTTP_STATUS_CALLBACK WINAPI WinHttpSetStatusCallback( HINTERNET handle, WINHT
 BOOL WINAPI WinHttpSetTimeouts( HINTERNET handle, int resolve, int connect, int send, int receive )
 {
     BOOL ret = TRUE;
-    object_header_t *hdr;
+    struct object_header *hdr;
 
     TRACE("%p, %d, %d, %d, %d\n", handle, resolve, connect, send, receive);
 
diff --git a/dlls/winhttp/winhttp_private.h b/dlls/winhttp/winhttp_private.h
index 7c41351ef1..c2f10e3ccf 100644
--- a/dlls/winhttp/winhttp_private.h
+++ b/dlls/winhttp/winhttp_private.h
@@ -39,20 +39,19 @@ static const WCHAR http1_0[] = {'H','T','T','P','/','1','.','0',0};
 static const WCHAR http1_1[] = {'H','T','T','P','/','1','.','1',0};
 static const WCHAR chunkedW[] = {'c','h','u','n','k','e','d',0};
 
-typedef struct _object_header_t object_header_t;
-
-typedef struct
+struct object_header;
+struct object_vtbl
 {
-    void (*destroy)( object_header_t * );
-    BOOL (*query_option)( object_header_t *, DWORD, void *, DWORD * );
-    BOOL (*set_option)( object_header_t *, DWORD, void *, DWORD );
-} object_vtbl_t;
+    void (*destroy)( struct object_header * );
+    BOOL (*query_option)( struct object_header *, DWORD, void *, DWORD * );
+    BOOL (*set_option)( struct object_header *, DWORD, void *, DWORD );
+};
 
-struct _object_header_t
+struct object_header
 {
     DWORD type;
     HINTERNET handle;
-    const object_vtbl_t *vtbl;
+    const struct object_vtbl *vtbl;
     DWORD flags;
     DWORD disable_flags;
     DWORD logon_policy;
@@ -77,7 +76,7 @@ typedef struct {
 
 typedef struct
 {
-    object_header_t hdr;
+    struct object_header hdr;
     CRITICAL_SECTION cs;
     LPWSTR agent;
     DWORD access;
@@ -99,7 +98,7 @@ typedef struct
 
 typedef struct
 {
-    object_header_t hdr;
+    struct object_header hdr;
     session_t *session;
     LPWSTR hostname;    /* final destination of the request */
     LPWSTR servername;  /* name of the server we directly connect to */
@@ -170,7 +169,7 @@ struct authinfo
 
 typedef struct
 {
-    object_header_t hdr;
+    struct object_header hdr;
     connect_t *connect;
     LPWSTR verb;
     LPWSTR path;
@@ -259,15 +258,15 @@ struct write_data
     DWORD *written;
 };
 
-object_header_t *addref_object( object_header_t * ) DECLSPEC_HIDDEN;
-object_header_t *grab_object( HINTERNET ) DECLSPEC_HIDDEN;
-void release_object( object_header_t * ) DECLSPEC_HIDDEN;
-HINTERNET alloc_handle( object_header_t * ) DECLSPEC_HIDDEN;
+struct object_header *addref_object( struct object_header * ) DECLSPEC_HIDDEN;
+struct object_header *grab_object( HINTERNET ) DECLSPEC_HIDDEN;
+void release_object( struct object_header * ) DECLSPEC_HIDDEN;
+HINTERNET alloc_handle( struct object_header * ) DECLSPEC_HIDDEN;
 BOOL free_handle( HINTERNET ) DECLSPEC_HIDDEN;
 
 void set_last_error( DWORD ) DECLSPEC_HIDDEN;
 DWORD get_last_error( void ) DECLSPEC_HIDDEN;
-void send_callback( object_header_t *, DWORD, LPVOID, DWORD ) DECLSPEC_HIDDEN;
+void send_callback( struct object_header *, DWORD, LPVOID, DWORD ) DECLSPEC_HIDDEN;
 void close_connection( request_t * ) DECLSPEC_HIDDEN;
 
 void netconn_close( netconn_t * ) DECLSPEC_HIDDEN;
-- 
2.11.0




More information about the wine-devel mailing list