diff options
| author | 2015-12-04 07:06:18 +0100 | |
|---|---|---|
| committer | 2015-12-04 07:06:18 +0100 | |
| commit | 5a2f80dcde2e76356bf568f1e2d71b054a7db45b (patch) | |
| tree | 31e8369980a2e4548223f529c31e8ca6ade5ce20 /src/osd/modules/sync | |
| parent | 41681c1703244abe68cbcf3096ca259bd061cc08 (diff) | |
clang-modernize part 5
Diffstat (limited to 'src/osd/modules/sync')
| -rw-r--r-- | src/osd/modules/sync/sync_mini.cpp | 4 | ||||
| -rw-r--r-- | src/osd/modules/sync/sync_windows.cpp | 24 | ||||
| -rw-r--r-- | src/osd/modules/sync/work_mini.cpp | 6 |
3 files changed, 17 insertions, 17 deletions
diff --git a/src/osd/modules/sync/sync_mini.cpp b/src/osd/modules/sync/sync_mini.cpp index a09303aed80..f5e6accb0c7 100644 --- a/src/osd/modules/sync/sync_mini.cpp +++ b/src/osd/modules/sync/sync_mini.cpp @@ -82,7 +82,7 @@ void osd_lock_free(osd_lock *lock) osd_event *osd_event_alloc(int manualreset, int initialstate) { - return NULL; + return nullptr; } @@ -129,7 +129,7 @@ int osd_event_wait(osd_event *event, osd_ticks_t timeout) osd_thread *osd_thread_create(osd_thread_callback callback, void *cbparam) { - return NULL; + return nullptr; } diff --git a/src/osd/modules/sync/sync_windows.cpp b/src/osd/modules/sync/sync_windows.cpp index c3d93c75fc9..9439d68b72c 100644 --- a/src/osd/modules/sync/sync_windows.cpp +++ b/src/osd/modules/sync/sync_windows.cpp @@ -68,7 +68,7 @@ struct osd_scalable_lock // GLOBAL VARIABLES //============================================================ -static try_enter_critical_section_ptr try_enter_critical_section = NULL; +static try_enter_critical_section_ptr try_enter_critical_section = nullptr; static int checked_for_try_enter = FALSE; @@ -80,8 +80,8 @@ static int checked_for_try_enter = FALSE; osd_lock *osd_lock_alloc(void) { osd_lock *lock = (osd_lock *)malloc(sizeof(*lock)); - if (lock == NULL) - return NULL; + if (lock == nullptr) + return nullptr; InitializeCriticalSection(&lock->critsect); return lock; } @@ -121,13 +121,13 @@ int osd_lock_try(osd_lock *lock) { // see if we can use TryEnterCriticalSection HMODULE library = LoadLibrary(TEXT("kernel32.dll")); - if (library != NULL) + if (library != nullptr) try_enter_critical_section = (try_enter_critical_section_ptr)GetProcAddress(library, "TryEnterCriticalSection"); checked_for_try_enter = TRUE; } // if we have it, use it, otherwise just block - if (try_enter_critical_section != NULL) + if (try_enter_critical_section != nullptr) result = (*try_enter_critical_section)(&lock->critsect); else EnterCriticalSection(&lock->critsect); @@ -203,7 +203,7 @@ INT32 win_atomic_add32(INT32 volatile *ptr, INT32 delta) osd_event *osd_event_alloc(int manualreset, int initialstate) { - return (osd_event *) CreateEvent(NULL, manualreset, initialstate, NULL); + return (osd_event *) CreateEvent(nullptr, manualreset, initialstate, nullptr); } //============================================================ @@ -271,15 +271,15 @@ osd_thread *osd_thread_create(osd_thread_callback callback, void *cbparam) uintptr_t handle; thread = (osd_thread *)calloc(1, sizeof(osd_thread)); - if (thread == NULL) - return NULL; + if (thread == nullptr) + return nullptr; thread->callback = callback; thread->param = cbparam; - handle = _beginthreadex(NULL, 0, worker_thread_entry, thread, 0, NULL); + handle = _beginthreadex(nullptr, 0, worker_thread_entry, thread, 0, nullptr); if (handle == 0) { free(thread); - return NULL; + return nullptr; } thread->handle = (HANDLE) handle; return thread; @@ -327,8 +327,8 @@ osd_scalable_lock *osd_scalable_lock_alloc(void) osd_scalable_lock *lock; lock = (osd_scalable_lock *)calloc(1, sizeof(*lock)); - if (lock == NULL) - return NULL; + if (lock == nullptr) + return nullptr; memset(lock, 0, sizeof(*lock)); #if USE_SCALABLE_LOCKS diff --git a/src/osd/modules/sync/work_mini.cpp b/src/osd/modules/sync/work_mini.cpp index fd359c6ee40..3d4b10fc539 100644 --- a/src/osd/modules/sync/work_mini.cpp +++ b/src/osd/modules/sync/work_mini.cpp @@ -80,8 +80,8 @@ osd_work_item *osd_work_item_queue_multiple(osd_work_queue *queue, osd_work_call // allocate memory to hold the result item = (osd_work_item *)malloc(sizeof(*item)); - if (item == NULL) - return NULL; + if (item == nullptr) + return nullptr; // loop over all requested items for (itemnum = 0; itemnum < numitems; itemnum++) @@ -97,7 +97,7 @@ osd_work_item *osd_work_item_queue_multiple(osd_work_queue *queue, osd_work_call if (flags & WORK_ITEM_FLAG_AUTO_RELEASE) { free(item); - item = NULL; + item = nullptr; } return item; } |
