diff options
author | Ryan Long <ryan.long@oarcorp.com> | 2021-07-28 16:10:00 -0400 |
---|---|---|
committer | Joel Sherrill <joel@rtems.org> | 2021-08-03 15:56:53 -0500 |
commit | d607f42d04c511c9d227dbf624665b1a4fc4ef8f (patch) | |
tree | 68b6879ddc3c4ede28ee49c5023a7c916291ff6f | |
parent | Remove TargetInfo global variable (diff) | |
download | rtems-tools-d607f42d04c511c9d227dbf624665b1a4fc4ef8f.tar.bz2 |
app_common: Remove functions and macros
- Moved functions from app_common to the file they are used
- Got rid of FileIsNewer() since it's not being used
- Removed macros
-rw-r--r-- | tester/covoar/TraceReaderLogQEMU.cc | 14 | ||||
-rw-r--r-- | tester/covoar/app_common.cc | 58 | ||||
-rw-r--r-- | tester/covoar/app_common.h | 3 | ||||
-rw-r--r-- | tester/covoar/covoar.cc | 20 |
4 files changed, 34 insertions, 61 deletions
diff --git a/tester/covoar/TraceReaderLogQEMU.cc b/tester/covoar/TraceReaderLogQEMU.cc index 37952a3..e65628e 100644 --- a/tester/covoar/TraceReaderLogQEMU.cc +++ b/tester/covoar/TraceReaderLogQEMU.cc @@ -63,6 +63,20 @@ #define MAX_LINE_LENGTH 512 +bool ReadUntilFound( FILE *file, const char *line ) +{ + char discardBuff[100]; + size_t len = strlen( line ); + + do { + if ( !fgets( discardBuff, 99, file ) ) + return false; + + if ( strncmp( discardBuff, line, len ) == 0 ) + return true; + } while (1); +} + namespace Trace { TraceReaderLogQEMU::TraceReaderLogQEMU() diff --git a/tester/covoar/app_common.cc b/tester/covoar/app_common.cc index 568d108..9fece7b 100644 --- a/tester/covoar/app_common.cc +++ b/tester/covoar/app_common.cc @@ -40,68 +40,10 @@ #include "app_common.h" #include "DesiredSymbols.h" #include "Explanations.h" - -#if HAVE_STAT64 -#define STAT stat64 -#else -#define STAT stat -#endif - -#if HAVE_OPEN64 -#define OPEN fopen64 -#else -#define OPEN fopen -#endif - /* * Global variables for the program */ -bool FileIsNewer( - const char *f1, - const char *f2 -) -{ - struct STAT buf1, buf2; - - if (STAT( f2, &buf2 ) == -1) - return true; - - if (STAT( f1, &buf1 ) == -1) - exit (1); - - if (buf1.st_mtime > buf2.st_mtime) - return true; - - return false; -} - -bool FileIsReadable( const char *f1 ) -{ - struct STAT buf1; - - if (STAT( f1, &buf1 ) == -1) - return false; - - if (buf1.st_size == 0) - return false; - - // XXX check permission ?? - return true; -} - -bool ReadUntilFound( FILE *file, const char *line ) -{ - char discardBuff[100]; - size_t len = strlen( line ); - - do { - if ( !fgets( discardBuff, 99, file ) ) - return false; - if ( strncmp( discardBuff, line, len ) == 0 ) - return true; - } while (1); -} diff --git a/tester/covoar/app_common.h b/tester/covoar/app_common.h index 454d389..5da4bb3 100644 --- a/tester/covoar/app_common.h +++ b/tester/covoar/app_common.h @@ -14,8 +14,5 @@ -bool FileIsNewer( const char *f1, const char *f2 ); -bool FileIsReadable( const char *f1 ); -bool ReadUntilFound( FILE *file, const char *line ); #endif diff --git a/tester/covoar/covoar.cc b/tester/covoar/covoar.cc index e0dc341..25724b5 100644 --- a/tester/covoar/covoar.cc +++ b/tester/covoar/covoar.cc @@ -30,6 +30,12 @@ #include "TargetFactory.h" #include "GcovData.h" +#if HAVE_STAT64 +#define STAT stat64 +#else +#define STAT stat +#endif + #if defined(_WIN32) || defined(__CYGWIN__) #define kill(p,s) raise(s) #endif @@ -40,6 +46,20 @@ typedef std::list<std::string> CoverageNames; typedef std::list<Coverage::ExecutableInfo*> Executables; typedef std::string option_error; +bool FileIsReadable( const char *f1 ) +{ + struct STAT buf1; + + if (STAT( f1, &buf1 ) == -1) + return false; + + if (buf1.st_size == 0) + return false; + + // XXX check permission ?? + return true; +} + /* * Create a build path from the executable paths. Also extract the build prefix * and BSP names. |