[Bf-blender-cvs] [6c1157201a1] master: Cleanup: simplify platform define checks

Campbell Barton noreply at git.blender.org
Fri Jul 10 15:02:41 CEST 2020


Commit: 6c1157201a143574c005147367bb2fd4ab320e73
Author: Campbell Barton
Date:   Fri Jul 10 22:59:12 2020 +1000
Branches: master
https://developer.blender.org/rB6c1157201a143574c005147367bb2fd4ab320e73

Cleanup: simplify platform define checks

Platforms besides WIN32 were in a single else clause, use elif instead.

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

M	source/blender/editors/space_file/fsmenu.c

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

diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c
index bff81201d60..d1f26dd37c9 100644
--- a/source/blender/editors/space_file/fsmenu.c
+++ b/source/blender/editors/space_file/fsmenu.c
@@ -754,8 +754,7 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks)
           fsmenu, FS_CATEGORY_OTHER, &FOLDERID_SkyDrive, NULL, ICON_URL, FS_INSERT_LAST);
     }
   }
-#else
-#  ifdef __APPLE__
+#elif defined(__APPLE__)
   {
     /* We store some known macOS system paths and corresponding icons
      * and names in the FS_CATEGORY_OTHER (not displayed directly) category. */
@@ -774,9 +773,9 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks)
 
     const char *home = BLI_getenv("HOME");
 
-#    define FS_MACOS_PATH(path, name, icon) \
-      BLI_snprintf(line, sizeof(line), path, home); \
-      fsmenu_insert_entry(fsmenu, FS_CATEGORY_OTHER, line, name, icon, FS_INSERT_LAST);
+#  define FS_MACOS_PATH(path, name, icon) \
+    BLI_snprintf(line, sizeof(line), path, home); \
+    fsmenu_insert_entry(fsmenu, FS_CATEGORY_OTHER, line, name, icon, FS_INSERT_LAST);
 
     FS_MACOS_PATH("%s/", NULL, ICON_HOME)
     FS_MACOS_PATH("%s/Desktop/", IFACE_("Desktop"), ICON_DESKTOP)
@@ -787,7 +786,7 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks)
     FS_MACOS_PATH("%s/Pictures/", IFACE_("Pictures"), ICON_FILE_IMAGE)
     FS_MACOS_PATH("%s/Library/Fonts/", IFACE_("Fonts"), ICON_FILE_FONT)
 
-#    undef FS_MACOS_PATH
+#  undef FS_MACOS_PATH
 
     /* Get mounted volumes better method OSX 10.6 and higher, see:
      * https://developer.apple.com/library/mac/#documentation/CoreFOundation/Reference/CFURLRef/Reference/reference.html
@@ -849,8 +848,8 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks)
 
     /* kLSSharedFileListFavoriteItems is deprecated, but available till macOS 10.15.
      * Will have to find a new method to sync the Finder Favorites with File Browser. */
-#    pragma GCC diagnostic push
-#    pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#  pragma GCC diagnostic push
+#  pragma GCC diagnostic ignored "-Wdeprecated-declarations"
     /* Finally get user favorite places */
     if (read_bookmarks) {
       UInt32 seed;
@@ -894,9 +893,9 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks)
       CFRelease(pathesArray);
       CFRelease(list);
     }
-#    pragma GCC diagnostic pop
+#  pragma GCC diagnostic pop
   }
-#  else
+#else
   /* unix */
   {
     const char *home = BLI_getenv("HOME");
@@ -932,7 +931,7 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks)
 
     {
       int found = 0;
-#    ifdef __linux__
+#  ifdef __linux__
       /* loop over mount points */
       struct mntent *mnt;
       FILE *fp;
@@ -994,7 +993,7 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks)
         }
         BLI_filelist_free(dir, dir_len);
       }
-#    endif
+#  endif
 
       /* fallback */
       if (!found) {
@@ -1003,7 +1002,6 @@ void fsmenu_read_system(struct FSMenu *fsmenu, int read_bookmarks)
       }
     }
   }
-#  endif
 #endif
 
 #if defined(WIN32) || defined(__APPLE__)



More information about the Bf-blender-cvs mailing list