windows: remove unnecessary pointer alignment code

This commit is contained in:
Bert Belder 2012-09-14 01:48:41 +02:00
parent b4a5bfb7e0
commit 5a2988fc33
2 changed files with 2 additions and 10 deletions

View File

@ -219,14 +219,11 @@ typedef union {
} fallback_;
} uv_rwlock_t;
#define UV_ONCE_INIT { 0, NULL, NULL }
#define UV_ONCE_INIT { 0, NULL }
typedef struct uv_once_s {
unsigned char ran;
/* The actual event handle must be aligned to sizeof(HANDLE), so in */
/* practice it might overlap padding a little. */
HANDLE event;
HANDLE padding;
} uv_once_t;
/* Platform-specific definitions for uv_spawn support. */

View File

@ -60,11 +60,6 @@ static NOINLINE void uv__once_inner(uv_once_t* guard,
void (*callback)(void)) {
DWORD result;
HANDLE existing_event, created_event;
HANDLE* event_ptr;
/* Fetch and align event_ptr */
event_ptr = (HANDLE*) (((uintptr_t) &guard->event + (sizeof(HANDLE) - 1)) &
~(sizeof(HANDLE) - 1));
created_event = CreateEvent(NULL, 1, 0, NULL);
if (created_event == 0) {
@ -72,7 +67,7 @@ static NOINLINE void uv__once_inner(uv_once_t* guard,
uv_fatal_error(GetLastError(), "CreateEvent");
}
existing_event = InterlockedCompareExchangePointer(event_ptr,
existing_event = InterlockedCompareExchangePointer(&guard->event,
created_event,
NULL);