[Bf-blender-cvs] [92c9dbf343c] master: Cleanup: avoid path copy in XDG support

Campbell Barton noreply at git.blender.org
Wed Feb 26 12:09:23 CET 2020


Commit: 92c9dbf343c0ac30e28fb660bd8ff9245f8ee345
Author: Campbell Barton
Date:   Wed Feb 26 21:50:40 2020 +1100
Branches: master
https://developer.blender.org/rB92c9dbf343c0ac30e28fb660bd8ff9245f8ee345

Cleanup: avoid path copy in XDG support

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

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 fb7822fe9ff..94747e79c84 100644
--- a/source/blender/editors/space_file/fsmenu.c
+++ b/source/blender/editors/space_file/fsmenu.c
@@ -192,17 +192,14 @@ static void fsmenu_xdg_insert_entry(GHash *xdg_map,
                                     int icon,
                                     const char *home)
 {
-  char dirpath[FILE_MAXDIR];
-  char *xdg_path = xdg_map ? BLI_ghash_lookup(xdg_map, key) : NULL;
+  char xdg_path_buf[FILE_MAXDIR];
+  const char *xdg_path = xdg_map ? BLI_ghash_lookup(xdg_map, key) : NULL;
   if (xdg_path == NULL) {
-    BLI_path_join(dirpath, sizeof(dirpath), home, default_path, NULL);
+    BLI_path_join(xdg_path_buf, sizeof(xdg_path_buf), home, default_path, NULL);
+    xdg_path = xdg_path_buf;
   }
-  else {
-    STRNCPY(dirpath, xdg_path);
-  }
-
   fsmenu_insert_entry(
-      fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, dirpath, IFACE_(default_path), icon, FS_INSERT_LAST);
+      fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, xdg_path, IFACE_(default_path), icon, FS_INSERT_LAST);
 }
 
 /** \} */



More information about the Bf-blender-cvs mailing list