Revision: 77330
          http://sourceforge.net/p/brlcad/code/77330
Author:   brlcad
Date:     2020-10-05 14:12:05 +0000 (Mon, 05 Oct 2020)
Log Message:
-----------
convert another gnu-extension call to getcwd() into bu_getcwd().  here, the 
non-null return looks beneficial.

Modified Paths:
--------------
    brlcad/trunk/src/liboptical/material.c

Modified: brlcad/trunk/src/liboptical/material.c
===================================================================
--- brlcad/trunk/src/liboptical/material.c      2020-10-05 14:04:04 UTC (rev 
77329)
+++ brlcad/trunk/src/liboptical/material.c      2020-10-05 14:12:05 UTC (rev 
77330)
@@ -149,24 +149,18 @@
     if (OPTICAL_DEBUG&OPTICAL_DEBUG_MATERIAL)
        bu_log("load_dynamic_shader(\"%s\")\n", sh_name);
 
-    cwd = getcwd((char *)NULL, (size_t)MAXPATHLEN);
+    cwd = bu_getcwd((char *)NULL, (size_t)MAXPATHLEN);
 
-    if (cwd) {
-       /* Look in the current working directory for {sh_name}.so */
-       snprintf(libname, sizeof(libname), "%s/%s.so", cwd, sh_name);
-       if ((shader_mfuncs = try_load(libname, material, sh_name)))
-           goto done;
+    /* Look in the current working directory for {sh_name}.so */
+    snprintf(libname, sizeof(libname), "%s/%s.so", cwd, sh_name);
+    if ((shader_mfuncs = try_load(libname, material, sh_name)))
+       goto done;
 
+    /* Look in the current working directory for shaders.so */
+    snprintf(libname, sizeof(libname), "%s/shaders.so", cwd);
+    if ((shader_mfuncs = try_load(libname, material, sh_name)))
+       goto done;
 
-       /* Look in the current working directory for shaders.so */
-       snprintf(libname, sizeof(libname), "%s/shaders.so", cwd);
-       if ((shader_mfuncs = try_load(libname, material, sh_name)))
-           goto done;
-
-    } else {
-       bu_log("Cannot get current working directory\n\tSkipping local shader 
load\n");
-    }
-
     /* Look in the location indicated by $LD_LIBRARY_PATH for
      * lib{sh_name}.so
      */

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to