[Bf-blender-cvs] [8bfb65e2547] master: Cleanup: remove 'else' after return

Campbell Barton noreply at git.blender.org
Wed Aug 31 07:05:21 CEST 2022


Commit: 8bfb65e2547f5fda1b3c9cee4d9ae88c73cf12a1
Author: Campbell Barton
Date:   Wed Aug 31 14:26:51 2022 +1000
Branches: master
https://developer.blender.org/rB8bfb65e2547f5fda1b3c9cee4d9ae88c73cf12a1

Cleanup: remove 'else' after return

===================================================================

M	intern/ghost/intern/GHOST_SystemWin32.cpp

===================================================================

diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp
index afc18704c9b..d011f413345 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -2123,8 +2123,6 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
 
 char *GHOST_SystemWin32::getClipboard(bool selection) const
 {
-  char *temp_buff;
-
   if (IsClipboardFormatAvailable(CF_UNICODETEXT) && OpenClipboard(NULL)) {
     wchar_t *buffer;
     HANDLE hData = GetClipboardData(CF_UNICODETEXT);
@@ -2138,7 +2136,7 @@ char *GHOST_SystemWin32::getClipboard(bool selection) const
       return NULL;
     }
 
-    temp_buff = alloc_utf_8_from_16(buffer, 0);
+    char *temp_buff = alloc_utf_8_from_16(buffer, 0);
 
     /* Buffer mustn't be accessed after CloseClipboard
      * it would like accessing free-d memory */
@@ -2147,7 +2145,7 @@ char *GHOST_SystemWin32::getClipboard(bool selection) const
 
     return temp_buff;
   }
-  else if (IsClipboardFormatAvailable(CF_TEXT) && OpenClipboard(NULL)) {
+  if (IsClipboardFormatAvailable(CF_TEXT) && OpenClipboard(NULL)) {
     char *buffer;
     size_t len = 0;
     HANDLE hData = GetClipboardData(CF_TEXT);
@@ -2162,7 +2160,7 @@ char *GHOST_SystemWin32::getClipboard(bool selection) const
     }
 
     len = strlen(buffer);
-    temp_buff = (char *)malloc(len + 1);
+    char *temp_buff = (char *)malloc(len + 1);
     strncpy(temp_buff, buffer, len);
     temp_buff[len] = '\0';
 
@@ -2173,9 +2171,7 @@ char *GHOST_SystemWin32::getClipboard(bool selection) const
 
     return temp_buff;
   }
-  else {
-    return NULL;
-  }
+  return nullptr;
 }
 
 void GHOST_SystemWin32::putClipboard(const char *buffer, bool selection) const



More information about the Bf-blender-cvs mailing list