From 994ab8985b0077ee1422ae8319f5625da05dc3bb Mon Sep 17 00:00:00 2001 From: Ray Molenkamp Date: Fri, 7 Aug 2020 14:53:42 -0600 Subject: Cleanup: Fix reported clang-tidy code-style issues. This resolves `error: statement should be inside braces` in some windows specific code that previously was unchecked by clang-tidy. --- intern/guardedalloc/intern/mmap_win.c | 43 +++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 15 deletions(-) (limited to 'intern/guardedalloc') diff --git a/intern/guardedalloc/intern/mmap_win.c b/intern/guardedalloc/intern/mmap_win.c index 245fe05b6af..a02a0f88fa9 100644 --- a/intern/guardedalloc/intern/mmap_win.c +++ b/intern/guardedalloc/intern/mmap_win.c @@ -138,10 +138,12 @@ void *mmap(void *UNUSED(start), size_t len, int prot, int flags, int fd, off_t o ptr = MapViewOfFile(maphandle, access_flags, 0, offset, 0); if (ptr == NULL) { DWORD dwLastErr = GetLastError(); - if (dwLastErr == ERROR_MAPPED_ALIGNMENT) + if (dwLastErr == ERROR_MAPPED_ALIGNMENT) { errno = EINVAL; - else + } + else { errno = EACCES; + } CloseHandle(maphandle); return MAP_FAILED; } @@ -182,18 +184,22 @@ static void mmap_addtail(volatile mmapListBase *listbase, void *vlink) { struct mmapLink *link = vlink; - if (link == NULL) + if (link == NULL) { return; - if (listbase == NULL) + } + if (listbase == NULL) { return; + } link->next = 0; link->prev = listbase->last; - if (listbase->last) + if (listbase->last) { ((struct mmapLink *)listbase->last)->next = link; - if (listbase->first == NULL) + } + if (listbase->first == NULL) { listbase->first = link; + } listbase->last = link; } @@ -201,30 +207,37 @@ static void mmap_remlink(volatile mmapListBase *listbase, void *vlink) { struct mmapLink *link = vlink; - if (link == NULL) + if (link == NULL) { return; - if (listbase == NULL) + } + if (listbase == NULL) { return; - - if (link->next) + } + if (link->next) { link->next->prev = link->prev; - if (link->prev) + } + if (link->prev) { link->prev->next = link->next; + } - if (listbase->last == link) + if (listbase->last == link) { listbase->last = link->prev; - if (listbase->first == link) + } + if (listbase->first == link) { listbase->first = link->next; + } } static void *mmap_findlink(volatile mmapListBase *listbase, void *ptr) { MemMap *mm; - if (ptr == NULL) + if (ptr == NULL) { return NULL; - if (listbase == NULL) + } + if (listbase == NULL) { return NULL; + } mm = (MemMap *)listbase->first; while (mm) { -- cgit v1.2.3