Menu ▾ ▴

#38 Unnecessary debug messages

open
nobody
None
5
7 hours ago
7 hours ago
Shozee H
No

When a data directory is located at a path different from the one specified when PLplot was built, the path that is checked is printed to stderr.

For example, when the PLPLOT_LIB environment variable is set, the specified directory is printed to stderr. I think this message is unnecessary for users who routinely change PLPLOT_LIB.

However, this information can be useful for debugging. Therefore, rather than removing the existing output entirely, I would suggest changing it to a debug message as follows:

index a9bce3c90..7272fb2cd 100644
--- a/src/plctrl.c
+++ b/src/plctrl.c
@@ -2284,7 +2284,7 @@ plLibOpenPdfstrm( PLCHAR_VECTOR fn )

         if ( ( file = pdf_fopen( fs, "rb" ) ) != NULL )
             goto done;

-        fprintf( stderr, PLPLOT_LIB_ENV "=\"%s\"\n", dn ); // what IS set?
+        pldebug( "plLibOpenPdfstr", PLPLOT_LIB_ENV "=\"%s\"\n", dn ); // what IS set?
     }#endif  // PLPLOT_LIB_ENV

@@ -2306,7 +2306,7 @@ plLibOpenPdfstrm( PLCHAR_VECTOR fn )

         if ( ( file = pdf_fopen( fs, "rb" ) ) != NULL )
             goto done;

-        fprintf( stderr, PLPLOT_HOME_ENV "=\"%s\"\n", dn ); // what IS set?
+        pldebug( "plLibOpenPdfstr", PLPLOT_HOME_ENV "=\"%s\"\n", dn ); // what IS set?
     }
 #endif  // PLPLOT_HOME_ENV/lib

diff --git a/src/plmap.c b/src/plmap.c
index 38f358ce2..bab61398a 100644
--- a/src/plmap.c
+++ b/src/plmap.c
@@ -835,7 +835,7 @@ OpenShapeFile( PLCHAR_VECTOR fn )

         if ( ( file = SHPOpenLL( fs, "rb", &sHooks ) ) != NULL )
             goto done;

-        fprintf( stderr, PLPLOT_LIB_ENV "=\"%s\"\n", dn ); // what IS set?
+        pldebug( "OpenShapeFile", PLPLOT_LIB_ENV "=\"%s\"\n", dn ); // what IS set?
     }
 #endif  // PLPLOT_LIB_ENV

@@ -857,7 +857,7 @@ OpenShapeFile( PLCHAR_VECTOR fn )

         if ( ( file = SHPOpenLL( fs, "rb", &sHooks ) ) != NULL )
             goto done;

-        fprintf( stderr, PLPLOT_HOME_ENV "=\"%s\"\n", dn ); // what IS set?
+        pldebug( "OpenShapeFile", PLPLOT_HOME_ENV "=\"%s\"\n", dn ); // what IS set?
     }
 #endif  // PLPLOT_HOME_ENV/lib

Discussion


Log in to post a comment.