From 8c27b8ffda31faf9c9a970c28eb378386d015f2e Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 14 Apr 2017 00:44:44 -0700 Subject: [PATCH] Don't use names of the form _BOINCxx Also, declare structs without a lot of noise --- lib/diagnostics_win.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/diagnostics_win.cpp b/lib/diagnostics_win.cpp index efb90836ea..7b6f2fdd6f 100644 --- a/lib/diagnostics_win.cpp +++ b/lib/diagnostics_win.cpp @@ -97,11 +97,11 @@ BOOL diagnostics_get_registry_value(LPCSTR lpName, LPDWORD lpdwType, LPDWORD lpd // Provide a structure to store process measurements at the time of a // crash. -typedef struct _BOINC_PROCESSENTRY { +struct BOINC_PROCESSENTRY { DWORD process_id; VM_COUNTERS vm_counters; IO_COUNTERS io_counters; -} BOINC_PROCESSENTRY, *PBOINC_PROCESSENTRY; +}; static BOINC_PROCESSENTRY diagnostics_process; @@ -116,7 +116,7 @@ static BOINC_PROCESSENTRY diagnostics_process; // to dump backtraces for all threads during an abort or // crash. This is platform specific in nature since it // depends on the OS datatypes. -typedef struct _BOINC_THREADLISTENTRY { +struct BOINC_THREADLISTENTRY { DWORD thread_id; HANDLE thread_handle; BOOL crash_suspend_exempt; @@ -129,14 +129,14 @@ typedef struct _BOINC_THREADLISTENTRY { INT crash_wait_reason; PEXCEPTION_POINTERS crash_exception_record; char crash_message[1024]; -} BOINC_THREADLISTENTRY, *PBOINC_THREADLISTENTRY; +}; -static std::vector diagnostics_threads; +static std::vector diagnostics_threads; static HANDLE hThreadListSync; // Initialize the thread list entry. -int diagnostics_init_thread_entry(PBOINC_THREADLISTENTRY entry) { +int diagnostics_init_thread_entry(BOINC_THREADLISTENTRY *entry) { entry->thread_id = 0; entry->thread_handle = 0; entry->crash_suspend_exempt = FALSE; @@ -210,8 +210,8 @@ int diagnostics_finish_thread_list() { // Return a pointer to the thread entry. // -PBOINC_THREADLISTENTRY diagnostics_find_thread_entry(DWORD dwThreadId) { - PBOINC_THREADLISTENTRY pThread = NULL; +BOINC_THREADLISTENTRY* diagnostics_find_thread_entry(DWORD dwThreadId) { + BOINC_THREADLISTENTRY* pThread = NULL; UINT uiIndex = 0; size_t size = 0; @@ -277,7 +277,7 @@ int diagnostics_get_process_information(PVOID* ppBuffer, PULONG pcbBuffer) { int diagnostics_update_thread_list() { DWORD dwCurrentProcessId = GetCurrentProcessId(); HANDLE hThread = NULL; - PBOINC_THREADLISTENTRY pThreadEntry = NULL; + BOINC_THREADLISTENTRY *pThreadEntry = NULL; ULONG cbBuffer = 32*1024; // 32k initial buffer PVOID pBuffer = NULL; PSYSTEM_PROCESSES pProcesses = NULL; @@ -358,7 +358,7 @@ int diagnostics_update_thread_list() { // thread dump the human readable exception information. int diagnostics_set_thread_exception_record(PEXCEPTION_POINTERS pExPtrs) { HANDLE hThread; - PBOINC_THREADLISTENTRY pThreadEntry = NULL; + BOINC_THREADLISTENTRY *pThreadEntry = NULL; // Wait for the ThreadListSync mutex before writing updates WaitForSingleObject(hThreadListSync, INFINITE); @@ -395,7 +395,7 @@ int diagnostics_set_thread_exception_record(PEXCEPTION_POINTERS pExPtrs) { // Set the current thread to suspend exempt status. Prevents deadlocks. int diagnostics_set_thread_exempt_suspend() { HANDLE hThread; - PBOINC_THREADLISTENTRY pThreadEntry = NULL; + BOINC_THREADLISTENTRY *pThreadEntry = NULL; // Wait for the ThreadListSync mutex before writing updates WaitForSingleObject(hThreadListSync, INFINITE); @@ -434,7 +434,7 @@ int diagnostics_set_thread_exempt_suspend() { // prototype needs to be compatible with C. int diagnostics_is_thread_exempt_suspend(long thread_id) { int retval = 1; - PBOINC_THREADLISTENTRY pThreadEntry = NULL; + BOINC_THREADLISTENTRY *pThreadEntry = NULL; // Wait for the ThreadListSync mutex before writing updates WaitForSingleObject(hThreadListSync, INFINITE); @@ -456,7 +456,7 @@ int diagnostics_is_thread_exempt_suspend(long thread_id) { // Set the current thread's crash message. int diagnostics_set_thread_crash_message(char* message) { HANDLE hThread; - PBOINC_THREADLISTENTRY pThreadEntry = NULL; + BOINC_THREADLISTENTRY *pThreadEntry = NULL; // Wait for the ThreadListSync mutex before writing updates WaitForSingleObject(hThreadListSync, INFINITE); @@ -1329,7 +1329,7 @@ int diagnostics_dump_process_information() { // Dump the captured information for a given thread. // -int diagnostics_dump_thread_information(PBOINC_THREADLISTENTRY pThreadEntry) { +int diagnostics_dump_thread_information(BOINC_THREADLISTENTRY *pThreadEntry) { std::string strStatusExtra; if (pThreadEntry->crash_state == StateWait) { @@ -1551,7 +1551,7 @@ UINT WINAPI diagnostics_unhandled_exception_monitor(LPVOID /* lpParameter */) { unsigned int i; CONTEXT c; BOINC_WINDOWCAPTURE window_info; - PBOINC_THREADLISTENTRY pThreadEntry = NULL; + BOINC_THREADLISTENTRY *pThreadEntry = NULL; // We should not suspend our crash dump thread. diagnostics_set_thread_exempt_suspend();