From ad66d8ac0c96e38eec6851b563d6a640c7fdcae9 Mon Sep 17 00:00:00 2001 From: Karl Wette Date: Wed, 29 Oct 2014 14:20:40 +0100 Subject: [PATCH] Remove deprecated function LALOpenDataFile() - replace with either fopen() (in tests) or LALFopen() (everywhere else) with mode "rb" (for SFTs) or "r" (everywhere else) - in XLALFindFiles(), remove prefixing of relative file names with './' to avoid LAL_DATA_PATH look-up; this is no longer necessary - no longer set LAL_DATA_PATH in environment scripts and pkg-config files, but do set LAL..._DATADIR in environment scripts to $(pkgdatadir) - refs #1676 Original: 933fe1e25ccbb8c8549ad939888d45d0552abaed --- lal/Makefile.am | 2 +- lal/lal.pc.in | 1 - lal/lalsupport.pc.in | 1 - lal/lib/lalsupport/include/FileIO.h | 2 - lal/lib/lalsupport/src/FileIO.c | 155 +----------------- .../src/ReadFrequencySeries_source.c | 2 +- lal/lib/lalsupport/src/ReadNoiseSpectrum.c | 2 +- .../lalsupport/src/ReadTimeSeries_source.c | 2 +- lal/lib/lalsupport/test/StreamInputTest.c | 2 +- .../lalsupport/test/StreamSeriesInputTest.c | 2 +- lalapps/Makefile.am | 2 +- lalburst/Makefile.am | 2 +- lalburst/lalburst.pc.in | 1 - laldetchar/Makefile.am | 2 +- laldetchar/laldetchar.pc.in | 1 - lalframe/Makefile.am | 2 +- lalframe/lalframe.pc.in | 1 - lalinference/Makefile.am | 2 +- lalinference/lalinference.pc.in | 1 - lalinspiral/Makefile.am | 2 +- lalinspiral/lalinspiral.pc.in | 1 - lalmetaio/Makefile.am | 2 +- lalmetaio/lalmetaio.pc.in | 1 - lalpulsar/Makefile.am | 2 +- lalpulsar/lalpulsar.pc.in | 1 - lalpulsar/src/DopplerFullScan.c | 2 +- lalpulsar/src/SFTfileIO-LAL.c | 4 +- lalpulsar/src/SFTfileIO.c | 12 +- lalpulsar/test/FlatMeshTest.c | 6 +- lalpulsar/test/LALDemodTest.c | 10 +- lalsimulation/Makefile.am | 2 +- lalsimulation/lalsimulation.pc.in | 1 - lalstochastic/Makefile.am | 2 +- lalstochastic/lalstochastic.pc.in | 1 - lalxml/Makefile.am | 2 +- lalxml/lalxml.pc.in | 1 - 36 files changed, 31 insertions(+), 206 deletions(-) diff --git a/lal/Makefile.am b/lal/Makefile.am index 5b36c56583..1df8df37f7 100644 --- a/lal/Makefile.am +++ b/lal/Makefile.am @@ -32,7 +32,7 @@ SUBDIRS = \ user_environment = \ set $(PACKAGE)_PREFIX $(prefix); \ - prepend LAL_DATA_PATH $(pkgdatadir); \ + set $(PACKAGE)_DATADIR $(pkgdatadir); \ prepend MANPATH $(mandir); \ prepend OCTAVE_PATH $(octexecdir); \ prepend PATH $(bindir); \ diff --git a/lal/lal.pc.in b/lal/lal.pc.in index f7455879ef..fff5d96213 100644 --- a/lal/lal.pc.in +++ b/lal/lal.pc.in @@ -3,7 +3,6 @@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ datarootdir=@datarootdir@ -LAL_DATA_PATH=@datadir@/@PACKAGE@ LAL_OCTAVE_PATH=@octexecdir@ LAL_PYTHON_PATH=@pyexecdir@ diff --git a/lal/lalsupport.pc.in b/lal/lalsupport.pc.in index 9c81de204b..e7e64474ba 100644 --- a/lal/lalsupport.pc.in +++ b/lal/lalsupport.pc.in @@ -3,7 +3,6 @@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ datarootdir=@datarootdir@ -LALSUPPORT_DATA_PATH=@datadir@/@PACKAGE@ LALSUPPORT_OCTAVE_PATH=@octexecdir@ LALSUPPORT_PYTHON_PATH=@pyexecdir@ diff --git a/lal/lib/lalsupport/include/FileIO.h b/lal/lib/lalsupport/include/FileIO.h index 7ac2ab862a..e38cff4fde 100644 --- a/lal/lib/lalsupport/include/FileIO.h +++ b/lal/lib/lalsupport/include/FileIO.h @@ -44,8 +44,6 @@ extern "C" { */ /*@{*/ -FILE *LALOpenDataFile( const char* ); - typedef struct tagLALFILE LALFILE; LALFILE *lalstdin(void); diff --git a/lal/lib/lalsupport/src/FileIO.c b/lal/lib/lalsupport/src/FileIO.c index 61c935506c..06da1c2a28 100644 --- a/lal/lib/lalsupport/src/FileIO.c +++ b/lal/lib/lalsupport/src/FileIO.c @@ -17,51 +17,6 @@ * MA 02111-1307 USA */ -/** - * \addtogroup FileIO_h - * - * ### Obsolete LAL Prototypes ### - * - * \code - * FILE *LALFopen( const char *path, const char *mode ); - * int LALFclose( FILE *stream ); - * \endcode - * - * ### Description ### - * - * The routines LALFopen() and LALFclose() are macro defined to be - * the same as the standard C routines LALFopen() and fclose(). These - * should only be used in test programs. - * - * The routine LALOpenDataFile() is used to open a data file for reading. - * This routine is also to be used in test programs only. Unless the data file - * is specified with an absolute path (beginning with a /), or a specific - * path (beginning with a ./ or a ../), the directory - * that the file is in is obtained from the environment variable - * \c LAL_DATA_PATH, which must be set at run-time. (If the environment - * variable is not set, the default path is . --- i.e., the current - * directory.) - * - * \c LAL_DATA_PATH should typically be set to - * /usr/local/share/lal, or wherever LAL data is installed in your system - * (which may be different if you used a --prefix argument when - * configuring LAL), but when the test suite is run with make check, the - * variable \c LAL_DATA_PATH is set to the current source directory. If the - * filename (including the directory path) is too long (more than 256 - * characters), LALOpenDataFile() returns \c NULL and sets - * \c errno to \c ENAMETOOLONG. - * - * \c LAL_DATA_PATH can be any colon-delimeted list of directories, which - * are searched in order (just like the \c PATH environment variable). - * An extra colon inserts the default data directory - * (\f$\langle\f$prefix\f$\rangle\f$/share/lal) into the search path at that - * point. E.g., a leading/trailing colon will look for the default data - * directory at the start/end of the list of directories. - * - * It is strongly recommended that LALOpenDataFile() be used when writing test code. - * - */ - #include #include @@ -109,120 +64,12 @@ LALFILE *lalstderr( void ) return &_lalstderr; } -#define STR( x ) #x -#define XSTR( x ) STR( x ) -#define INFOMSG( msg, file ) ( ( lalDebugLevel & LALINFO ) ? \ - LALPrintError( "Info: function LALOpenDataFile, file " __FILE__ ", line " \ - XSTR( __LINE__ ) ", $Id$\n\t%s %s\n", msg, file ) : 0 ) -#define ERRORMSG( file ) ( ( lalDebugLevel & LALERROR ) ? \ - LALPrintError( "Info: function LALOpenDataFile, file " __FILE__ ", line " \ - XSTR( __LINE__ ) ", $Id$\n\tCould not open data file %s\n", file ) : 0 ) - -#ifndef LAL_PREFIX -#define LAL_PREFIX "/usr/local" -#endif - - - -FILE * -LALOpenDataFile( const char *fname ) -{ - FILE *fp; - const char *path; - char *datapath; /* locally allocated copy of env-var LAL_DATA_PATH */ - const char *p0; /* pointer to current sub-path of datapath*/ - char *p1; /* pointer to next sub-path */ - char fdata[32768]; - int n; - - XLAL_PRINT_DEPRECATION_WARNING("XLALFileResolvePathLong"); - - if ( (fname==NULL) || ( strlen(fname)==0) ) { - return NULL; - } - - if ( *fname == '/' ) /* absolute path is given */ - { - fp = LALFopen( fname, "r" ); - if ( ! fp ) - ERRORMSG( fname ); - else - INFOMSG( "Opening data file", fname ); - return fp; - } - - n = strlen( fname ); - if ( *fname == '.' && n > 0 && ( fname[1] == '/' || ( n > 1 && fname[1] == '.' - && fname[2] == '/' ) ) ) /* specific path is given */ - { - fp = LALFopen( fname, "r" ); - if ( ! fp ) - ERRORMSG( fname ); - else - INFOMSG( "Opening data file", fname ); - return fp; - } - - path = getenv( "LAL_DATA_PATH" ); - - if ( ! path || ! strlen( path ) ) /* path is NULL or empty */ - { - fp = LALFopen( fname, "r" ); - if ( ! fp ) - ERRORMSG( fname ); - else - INFOMSG( "Opening data file", fname ); - return fp; - } - - /* scan through all directories in colon-delmited list of directories */ - if ( (datapath = LALCalloc (strlen(path)+1, 1)) == NULL) /* we need local copy */ - { - ERRORMSG( fname ); - return NULL; - } - strcpy (datapath, path); - p0 = datapath; - do { - p1 = strchr( p0, ':' ); /* look for additional directories */ - if ( p1 ) /* there are more things in the list */ - *p1++ = 0; /* NUL-terminate current directory */ - if ( ! strlen( p0 ) ) /* this directory is empty */ - p0 = LAL_PREFIX "/share/lal"; /* default data directory */ - - n = snprintf( fdata, sizeof(fdata), "%s/%s", p0 ? p0 : ".", fname ); - if ( n > (int) sizeof( fdata ) ) /* data file name too long */ - { - errno = ENAMETOOLONG; - LALFree (datapath); - return NULL; - } - - INFOMSG( "Looking for file", fdata ); - fp = LALFopen( fdata, "r" ); - if ( fp ) /* we've found it! */ - { - INFOMSG( "Opening data file", fdata ); - LALFree (datapath); - return fp; - } - - p0 = p1; - } - while ( p0 ); - - LALFree (datapath); - ERRORMSG( fname ); - return NULL; -} - /** 'Resolve' a given filename 'fname', returning a file path where the * file can successfully be opened by fopen() using mode='rb'. * * Return: successful file-path or NULL if failed. * - * Resolving follows an algorithm similar to what LALOpenDataFile() did, - * namely if 'fname' contains a + * Resolving uses the following algorithm: if 'fname' contains a * i) (relative or absolute) path: only tries to open that path directly * ii) pure filename: try 1) local dir, then 2) search LAL_DATA_PATH, then 3) try fallbackdir * return first successful hit diff --git a/lal/lib/lalsupport/src/ReadFrequencySeries_source.c b/lal/lib/lalsupport/src/ReadFrequencySeries_source.c index 2945d26c04..168f8e3fb0 100644 --- a/lal/lib/lalsupport/src/ReadFrequencySeries_source.c +++ b/lal/lib/lalsupport/src/ReadFrequencySeries_source.c @@ -42,7 +42,7 @@ void FUNC ( LALStatus* status, /* if (filename == NULL) return; */ - fp = LALOpenDataFile( filename ); + fp = LALFopen( filename, "r" ); if (fp == NULL) { ABORT( status, READFTSERIESH_EFILENOTFOUND, diff --git a/lal/lib/lalsupport/src/ReadNoiseSpectrum.c b/lal/lib/lalsupport/src/ReadNoiseSpectrum.c index 863f47124b..9997d34339 100644 --- a/lal/lib/lalsupport/src/ReadNoiseSpectrum.c +++ b/lal/lib/lalsupport/src/ReadNoiseSpectrum.c @@ -103,7 +103,7 @@ LALReadNoiseSpectrum(LALStatus *stat, REAL4FrequencySeries *spectrum, CHAR *fnam ATTATCHSTATUSPTR(stat); /* this is the file containing the spectrum data */ - if ( !(fp = LALOpenDataFile( fname )) ) + if ( !(fp = LALFopen( fname, "r" )) ) { ABORT(stat, LALREADNOISESPECTRUMH_EOPEN, LALREADNOISESPECTRUMH_MSGEOPEN); } diff --git a/lal/lib/lalsupport/src/ReadTimeSeries_source.c b/lal/lib/lalsupport/src/ReadTimeSeries_source.c index 88bc736393..3daba55091 100644 --- a/lal/lib/lalsupport/src/ReadTimeSeries_source.c +++ b/lal/lib/lalsupport/src/ReadTimeSeries_source.c @@ -44,7 +44,7 @@ FUNC ( LALStatus* status, /* if (filename == NULL) return; */ - fp = LALOpenDataFile( filename ); + fp = LALFopen( filename, "r" ); if (fp == NULL) { ABORT( status, READFTSERIESH_EFILENOTFOUND, diff --git a/lal/lib/lalsupport/test/StreamInputTest.c b/lal/lib/lalsupport/test/StreamInputTest.c index 12e008ad3a..81dd2aa422 100644 --- a/lal/lib/lalsupport/test/StreamInputTest.c +++ b/lal/lib/lalsupport/test/StreamInputTest.c @@ -382,7 +382,7 @@ main(int argc, char **argv) /* Open input and output files. */ if ( strcmp( infile, "stdin" ) ) { - if ( !( fpIn = LALOpenDataFile( infile ) ) ) { + if ( !( fpIn = fopen( infile, "r" ) ) ) { ERROR( STREAMINPUTTESTC_EFILE, "- " STREAMINPUTTESTC_MSGEFILE, infile ); return STREAMINPUTTESTC_EFILE; diff --git a/lal/lib/lalsupport/test/StreamSeriesInputTest.c b/lal/lib/lalsupport/test/StreamSeriesInputTest.c index 22e91f6da1..a88aa4b51f 100644 --- a/lal/lib/lalsupport/test/StreamSeriesInputTest.c +++ b/lal/lib/lalsupport/test/StreamSeriesInputTest.c @@ -192,7 +192,7 @@ main(int argc, char **argv) /* Open input and output files. */ if ( strcmp( infile, "stdin" ) ) { - if ( !( fpIn = LALOpenDataFile( infile ) ) ) { + if ( !( fpIn = fopen( infile, "r" ) ) ) { ERROR( STREAMSERIESINPUTTESTC_EFILE, "- " STREAMSERIESINPUTTESTC_MSGEFILE, infile ); return STREAMSERIESINPUTTESTC_EFILE; diff --git a/lalapps/Makefile.am b/lalapps/Makefile.am index 288ea6a00e..cf70de0f4d 100644 --- a/lalapps/Makefile.am +++ b/lalapps/Makefile.am @@ -29,7 +29,7 @@ SUBDIRS = \ user_environment = \ set $(PACKAGE)_PREFIX $(prefix); \ - prepend LAL_DATA_PATH $(pkgdatadir); \ + set $(PACKAGE)_DATADIR $(pkgdatadir); \ prepend MANPATH $(mandir); \ prepend PATH $(bindir); \ prepend PYTHONPATH $(pyexecdir) $(pythondir); \ diff --git a/lalburst/Makefile.am b/lalburst/Makefile.am index 18cfd8770c..042ed6c589 100644 --- a/lalburst/Makefile.am +++ b/lalburst/Makefile.am @@ -30,7 +30,7 @@ SUBDIRS = \ user_environment = \ set $(PACKAGE)_PREFIX $(prefix); \ - prepend LAL_DATA_PATH $(pkgdatadir); \ + set $(PACKAGE)_DATADIR $(pkgdatadir); \ prepend MANPATH $(mandir); \ prepend OCTAVE_PATH $(octexecdir); \ prepend PATH $(bindir); \ diff --git a/lalburst/lalburst.pc.in b/lalburst/lalburst.pc.in index dd23c2360c..c151565bcf 100644 --- a/lalburst/lalburst.pc.in +++ b/lalburst/lalburst.pc.in @@ -3,7 +3,6 @@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ datarootdir=@datarootdir@ -LALBURST_DATA_PATH=@datadir@/@PACKAGE@ LALBURST_OCTAVE_PATH=@octexecdir@ LALBURST_PYTHON_PATH=@pyexecdir@ diff --git a/laldetchar/Makefile.am b/laldetchar/Makefile.am index 316eca3348..925d4a0b26 100644 --- a/laldetchar/Makefile.am +++ b/laldetchar/Makefile.am @@ -29,7 +29,7 @@ SUBDIRS = \ user_environment = \ set $(PACKAGE)_PREFIX $(prefix); \ - prepend LAL_DATA_PATH $(pkgdatadir); \ + set $(PACKAGE)_DATADIR $(pkgdatadir); \ prepend MANPATH $(mandir); \ prepend OCTAVE_PATH $(octexecdir); \ prepend PATH $(bindir); \ diff --git a/laldetchar/laldetchar.pc.in b/laldetchar/laldetchar.pc.in index c872d68193..53760f83e3 100644 --- a/laldetchar/laldetchar.pc.in +++ b/laldetchar/laldetchar.pc.in @@ -3,7 +3,6 @@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ datarootdir=@datarootdir@ -LALDETCHAR_DATA_PATH=@datadir@/@PACKAGE@ LALDETCHAR_OCTAVE_PATH=@octexecdir@ LADETCHARL_PYTHON_PATH=@pyexecdir@ diff --git a/lalframe/Makefile.am b/lalframe/Makefile.am index d617f49fe8..9cb95854f9 100644 --- a/lalframe/Makefile.am +++ b/lalframe/Makefile.am @@ -29,7 +29,7 @@ SUBDIRS = \ user_environment = \ set $(PACKAGE)_PREFIX $(prefix); \ - prepend LAL_DATA_PATH $(pkgdatadir); \ + set $(PACKAGE)_DATADIR $(pkgdatadir); \ prepend MANPATH $(mandir); \ prepend OCTAVE_PATH $(octexecdir); \ prepend PATH $(bindir); \ diff --git a/lalframe/lalframe.pc.in b/lalframe/lalframe.pc.in index 92f71092fb..121114a7f2 100644 --- a/lalframe/lalframe.pc.in +++ b/lalframe/lalframe.pc.in @@ -3,7 +3,6 @@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ datarootdir=@datarootdir@ -LALFRAME_DATA_PATH=@datadir@/@PACKAGE@ LALFRAME_OCTAVE_PATH=@octexecdir@ LALFRAME_PYTHON_PATH=@pyexecdir@ diff --git a/lalinference/Makefile.am b/lalinference/Makefile.am index eb1304aea5..f631da4406 100644 --- a/lalinference/Makefile.am +++ b/lalinference/Makefile.am @@ -29,7 +29,7 @@ SUBDIRS = \ user_environment = \ set $(PACKAGE)_PREFIX $(prefix); \ - prepend LAL_DATA_PATH $(pkgdatadir); \ + set $(PACKAGE)_DATADIR $(pkgdatadir); \ prepend MANPATH $(mandir); \ prepend OCTAVE_PATH $(octexecdir); \ prepend PATH $(bindir); \ diff --git a/lalinference/lalinference.pc.in b/lalinference/lalinference.pc.in index 1ef79351c3..50e3525ace 100644 --- a/lalinference/lalinference.pc.in +++ b/lalinference/lalinference.pc.in @@ -3,7 +3,6 @@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ datarootdir=@datarootdir@ -LALINFERENCE_DATA_PATH=@datadir@/@PACKAGE@ LALINFERENCE_OCTAVE_PATH=@octexecdir@ LALINFERENCE_PYTHON_PATH=@pyexecdir@ diff --git a/lalinspiral/Makefile.am b/lalinspiral/Makefile.am index ee2f2fdeda..68480b51b8 100644 --- a/lalinspiral/Makefile.am +++ b/lalinspiral/Makefile.am @@ -30,7 +30,7 @@ SUBDIRS = \ user_environment = \ set $(PACKAGE)_PREFIX $(prefix); \ - prepend LAL_DATA_PATH $(pkgdatadir); \ + set $(PACKAGE)_DATADIR $(pkgdatadir); \ prepend MANPATH $(mandir); \ prepend OCTAVE_PATH $(octexecdir); \ prepend PATH $(bindir); \ diff --git a/lalinspiral/lalinspiral.pc.in b/lalinspiral/lalinspiral.pc.in index bbe8cfbf34..d0dc88f5f1 100644 --- a/lalinspiral/lalinspiral.pc.in +++ b/lalinspiral/lalinspiral.pc.in @@ -3,7 +3,6 @@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ datarootdir=@datarootdir@ -LALINSPIRAL_DATA_PATH=@datadir@/@PACKAGE@ LALINSPIRAL_OCTAVE_PATH=@octexecdir@ LALINSPIRAL_PYTHON_PATH=@pyexecdir@ diff --git a/lalmetaio/Makefile.am b/lalmetaio/Makefile.am index cd91dc4eec..6115d10603 100644 --- a/lalmetaio/Makefile.am +++ b/lalmetaio/Makefile.am @@ -29,7 +29,7 @@ SUBDIRS = \ user_environment = \ set $(PACKAGE)_PREFIX $(prefix); \ - prepend LAL_DATA_PATH $(pkgdatadir); \ + set $(PACKAGE)_DATADIR $(pkgdatadir); \ prepend MANPATH $(mandir); \ prepend OCTAVE_PATH $(octexecdir); \ prepend PATH $(bindir); \ diff --git a/lalmetaio/lalmetaio.pc.in b/lalmetaio/lalmetaio.pc.in index d59321a45a..7da44d2e76 100644 --- a/lalmetaio/lalmetaio.pc.in +++ b/lalmetaio/lalmetaio.pc.in @@ -3,7 +3,6 @@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ datarootdir=@datarootdir@ -LALMETAIO_DATA_PATH=@datadir@/@PACKAGE@ LALMETAIO_OCTAVE_PATH=@octexecdir@ LALMETAIO_PYTHON_PATH=@pyexecdir@ diff --git a/lalpulsar/Makefile.am b/lalpulsar/Makefile.am index 3a6991f7a5..81625e43af 100644 --- a/lalpulsar/Makefile.am +++ b/lalpulsar/Makefile.am @@ -30,7 +30,7 @@ SUBDIRS = \ user_environment = \ set $(PACKAGE)_PREFIX $(prefix); \ - prepend LAL_DATA_PATH $(pkgdatadir); \ + set $(PACKAGE)_DATADIR $(pkgdatadir); \ prepend MANPATH $(mandir); \ prepend OCTAVE_PATH $(octexecdir); \ prepend PATH $(bindir); \ diff --git a/lalpulsar/lalpulsar.pc.in b/lalpulsar/lalpulsar.pc.in index 406c643d63..3f1888c67d 100644 --- a/lalpulsar/lalpulsar.pc.in +++ b/lalpulsar/lalpulsar.pc.in @@ -3,7 +3,6 @@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ datarootdir=@datarootdir@ -LALPULSAR_DATA_PATH=@datadir@/@PACKAGE@ LALPULSAR_OCTAVE_PATH=@octexecdir@ LALPULSAR_PYTHON_PATH=@pyexecdir@ diff --git a/lalpulsar/src/DopplerFullScan.c b/lalpulsar/src/DopplerFullScan.c index d4f15a59ab..e0e123b48e 100644 --- a/lalpulsar/src/DopplerFullScan.c +++ b/lalpulsar/src/DopplerFullScan.c @@ -820,7 +820,7 @@ loadFullGridFile ( LALStatus *status, } /* for s < max_spins */ /* open input data file */ - if ( (fp = LALOpenDataFile (init->gridFile)) == NULL) { + if ( (fp = LALFopen (init->gridFile, "r")) == NULL) { XLALPrintError ("Could not open data-file: `%s`\n\n", init->gridFile); ABORT (status, CONFIGFILEH_EFILE, CONFIGFILEH_MSGEFILE); } diff --git a/lalpulsar/src/SFTfileIO-LAL.c b/lalpulsar/src/SFTfileIO-LAL.c index 9071d36f36..b51fdb2a6d 100644 --- a/lalpulsar/src/SFTfileIO-LAL.c +++ b/lalpulsar/src/SFTfileIO-LAL.c @@ -922,7 +922,7 @@ LALReadSFTheader (LALStatus *status, /**< pointer to LALStatus structure */ ASSERT (fname, status, SFTFILEIO_ENULL, SFTFILEIO_MSGENULL); /* opening the SFT binary file */ - fp = LALOpenDataFile( fname ); + fp = LALFopen( fname, "rb" ); if (fp == NULL) { ABORT (status, SFTFILEIO_EFILE, SFTFILEIO_MSGEFILE); } @@ -1072,7 +1072,7 @@ LALReadSFTdata(LALStatus *status, /**< pointer to LALStatus structure */ offset = fminBinIndex - header.fminBinIndex; /* open file for reading */ - if ( (fp = LALOpenDataFile( fname )) == NULL) { + if ( (fp = LALFopen( fname, "rb" )) == NULL) { ABORT (status, SFTFILEIO_EFILE, SFTFILEIO_MSGEFILE); } diff --git a/lalpulsar/src/SFTfileIO.c b/lalpulsar/src/SFTfileIO.c index 2b4661bdbc..f8fe37dca1 100644 --- a/lalpulsar/src/SFTfileIO.c +++ b/lalpulsar/src/SFTfileIO.c @@ -48,6 +48,7 @@ #endif #include +#include #include #include #include @@ -2482,17 +2483,10 @@ XLALFindFiles (const CHAR *globstring) LALParsedDataFile *list = NULL; CHAR* listfname = NULL; - /* create list file name - prefix with "./" if not an absolute file name (see LALOpenDataFile()) */ - if ((listfname = LALCalloc(1, strlen(globstring) + 3)) == NULL) { + /* extract list file name */ + if ((listfname = XLALStringDuplicate(globstring + strlen(LIST_PREFIX))) == NULL) { XLAL_ERROR_NULL ( XLAL_ENOMEM ) ; } - ptr1 = globstring + strlen(LIST_PREFIX); - if (*ptr1 == '/') - *listfname = '\0'; - else - strcpy(listfname, "./"); - strcat(listfname, ptr1); #undef LIST_PREFIX /* read list of file names from file */ diff --git a/lalpulsar/test/FlatMeshTest.c b/lalpulsar/test/FlatMeshTest.c index 1b57250656..d4f3f07bca 100644 --- a/lalpulsar/test/FlatMeshTest.c +++ b/lalpulsar/test/FlatMeshTest.c @@ -269,21 +269,21 @@ main(int argc, char **argv) if ( eigenfile ) { /* Read input files into vector sequences. */ - if ( !( fp = LALOpenDataFile( eigenfile ) ) ) { + if ( !( fp = fopen( eigenfile, "r" ) ) ) { ERROR( FLATMESHTESTC_EFILE, "- " FLATMESHTESTC_MSGEFILE, eigenfile ); return FLATMESHTESTC_EFILE; } SUB( LALSReadVectorSequence( &stat, &matrix, fp ), &stat ); fclose( fp ); - if ( !( fp = LALOpenDataFile( inversefile ) ) ) { + if ( !( fp = fopen( inversefile, "r" ) ) ) { ERROR( FLATMESHTESTC_EFILE, "- " FLATMESHTESTC_MSGEFILE, inversefile ); return FLATMESHTESTC_EFILE; } SUB( LALSReadVectorSequence( &stat, &matrixInv, fp ), &stat ); fclose( fp ); - if ( !( fp = LALOpenDataFile( rangefile ) ) ) { + if ( !( fp = fopen( rangefile, "r" ) ) ) { ERROR( FLATMESHTESTC_EFILE, "- " FLATMESHTESTC_MSGEFILE, rangefile ); return FLATMESHTESTC_EFILE; diff --git a/lalpulsar/test/LALDemodTest.c b/lalpulsar/test/LALDemodTest.c index 029a834ade..46f77dbc1b 100644 --- a/lalpulsar/test/LALDemodTest.c +++ b/lalpulsar/test/LALDemodTest.c @@ -188,8 +188,6 @@ * \code * lalDebugLevel * LALMalloc() - * LALFopen() - * LALFclose() * LALSCreateVector() * LALCreateRandomParams() * LALNormalDeviates() @@ -354,7 +352,7 @@ int main(int argc, char **argv) { strcpy(basicInputsFile, argv[++arg]); arg++; - if(LALOpenDataFile(basicInputsFile)==NULL) + if(fopen(basicInputsFile, "r")==NULL) { ERROR(LALDEMODH_ENOFILE, LALDEMODH_MSGENOFILE, 0); XLALPrintError(USAGE, *argv); @@ -392,7 +390,7 @@ int main(int argc, char **argv) /* default: no input file specified */ else if(basicInputsFile==NULL) { - bif=LALOpenDataFile("in.data"); + bif=fopen("in.data", "r"); } /* erroneous command line argument */ @@ -427,7 +425,7 @@ int main(int argc, char **argv) /***** GET INPUTS FROM FILES *****/ - bif=LALOpenDataFile(basicInputsFile); + bif=fopen(basicInputsFile, "r"); fscanf(bif, "%lf\n%lf\n%lf\n%lf\n%lf\n%lf\n%lf\n%lf\n%d\n%le\n%le\n%le\n%le\n%le\n%lf\n" " %lf\n%d\n%le\n%le\n%le\n%le\n%le\n%lf\n%lf\n", @@ -443,7 +441,7 @@ int main(int argc, char **argv) &templateParams->spind->spParams[4], &templateParams->skyP->alpha, &templateParams->skyP->delta); - LALFclose(bif); + fclose(bif); /***** END FILE INPUT *****/ diff --git a/lalsimulation/Makefile.am b/lalsimulation/Makefile.am index d792842e2f..23d50d3be7 100644 --- a/lalsimulation/Makefile.am +++ b/lalsimulation/Makefile.am @@ -29,7 +29,7 @@ SUBDIRS = \ user_environment = \ set $(PACKAGE)_PREFIX $(prefix); \ - prepend LAL_DATA_PATH $(pkgdatadir); \ + set $(PACKAGE)_DATADIR $(pkgdatadir); \ prepend MANPATH $(mandir); \ prepend OCTAVE_PATH $(octexecdir); \ prepend PATH $(bindir); \ diff --git a/lalsimulation/lalsimulation.pc.in b/lalsimulation/lalsimulation.pc.in index 2729325fee..cecce31541 100644 --- a/lalsimulation/lalsimulation.pc.in +++ b/lalsimulation/lalsimulation.pc.in @@ -3,7 +3,6 @@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ datarootdir=@datarootdir@ -LALSIMULATION_DATA_PATH=@datadir@/@PACKAGE@ LALSIMULATION_OCTAVE_PATH=@octexecdir@ LALSIMULATION_PYTHON_PATH=@pyexecdir@ diff --git a/lalstochastic/Makefile.am b/lalstochastic/Makefile.am index a53ef8adf8..66c7371f08 100644 --- a/lalstochastic/Makefile.am +++ b/lalstochastic/Makefile.am @@ -30,7 +30,7 @@ SUBDIRS = \ user_environment = \ set $(PACKAGE)_PREFIX $(prefix); \ - prepend LAL_DATA_PATH $(pkgdatadir); \ + set $(PACKAGE)_DATADIR $(pkgdatadir); \ prepend MANPATH $(mandir); \ prepend OCTAVE_PATH $(octexecdir); \ prepend PATH $(bindir); \ diff --git a/lalstochastic/lalstochastic.pc.in b/lalstochastic/lalstochastic.pc.in index c3a966e403..c60844715b 100644 --- a/lalstochastic/lalstochastic.pc.in +++ b/lalstochastic/lalstochastic.pc.in @@ -3,7 +3,6 @@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ datarootdir=@datarootdir@ -LALSTOCHASTIC_DATA_PATH=@datadir@/@PACKAGE@ LALSTOCHASTIC_OCTAVE_PATH=@octexecdir@ LALSTOCHASTIC_PYTHON_PATH=@pyexecdir@ diff --git a/lalxml/Makefile.am b/lalxml/Makefile.am index 499f679835..e4c91b5359 100644 --- a/lalxml/Makefile.am +++ b/lalxml/Makefile.am @@ -29,7 +29,7 @@ SUBDIRS = \ user_environment = \ set $(PACKAGE)_PREFIX $(prefix); \ - prepend LAL_DATA_PATH $(pkgdatadir); \ + set $(PACKAGE)_DATADIR $(pkgdatadir); \ prepend MANPATH $(mandir); \ prepend OCTAVE_PATH $(octexecdir); \ prepend PATH $(bindir); \ diff --git a/lalxml/lalxml.pc.in b/lalxml/lalxml.pc.in index 0b1fae9c74..b6f985af5a 100644 --- a/lalxml/lalxml.pc.in +++ b/lalxml/lalxml.pc.in @@ -3,7 +3,6 @@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ datarootdir=@datarootdir@ -LALXML_DATA_PATH=@datadir@/@PACKAGE@ LALXML_OCTAVE_PATH=@octexecdir@ LALXML_PYTHON_PATH=@pyexecdir@ -- GitLab