Refactorization: Removed lengthy comment and actually check std::ifstream::operator bool().
This commit is contained in:
parent
b788d96bb9
commit
4e5b9dc692
|
@ -34,21 +34,13 @@
|
|||
#include <cstdlib> // EXIT_FAILURE
|
||||
|
||||
#ifdef HAVE_RULES
|
||||
// xml is used in rules
|
||||
// xml is used for rules
|
||||
#include <tinyxml2.h>
|
||||
#endif
|
||||
|
||||
static void AddFilesToList(const std::string& FileList, std::vector<std::string>& PathNames)
|
||||
{
|
||||
// to keep things initially simple, if the file can't be opened, just be
|
||||
// silent and move on
|
||||
// ideas : we could also require this should be an xml file, with the filenames
|
||||
// specified in an xml structure
|
||||
// we could elaborate this then, to also include the I-paths, ...
|
||||
// basically for everything that makes the command line very long
|
||||
// xml is a bonus then, since we can easily extend it
|
||||
// we need a good parser then -> suggestion : TinyXml
|
||||
// drawback : creates a dependency
|
||||
// To keep things initially simple, if the file can't be opened, just be silent and move on.
|
||||
std::istream *Files;
|
||||
std::ifstream Infile;
|
||||
if (FileList.compare("-") == 0) { // read from stdin
|
||||
|
@ -57,7 +49,7 @@ static void AddFilesToList(const std::string& FileList, std::vector<std::string>
|
|||
Infile.open(FileList.c_str());
|
||||
Files = &Infile;
|
||||
}
|
||||
if (Files) {
|
||||
if (Files && *Files) {
|
||||
std::string FileName;
|
||||
while (std::getline(*Files, FileName)) { // next line
|
||||
if (!FileName.empty()) {
|
||||
|
@ -69,8 +61,7 @@ static void AddFilesToList(const std::string& FileList, std::vector<std::string>
|
|||
|
||||
static void AddInclPathsToList(const std::string& FileList, std::list<std::string>* PathNames)
|
||||
{
|
||||
// to keep things initially simple, if the file can't be opened, just be
|
||||
// silent and move on
|
||||
// To keep things initially simple, if the file can't be opened, just be silent and move on.
|
||||
std::ifstream Files(FileList.c_str());
|
||||
if (Files) {
|
||||
std::string PathName;
|
||||
|
|
Loading…
Reference in New Issue