Skip to content

Commit

Permalink
Make path scanning fully non-recursive.
Browse files Browse the repository at this point in the history
See #6.
  • Loading branch information
jzmaddock committed Nov 25, 2019
1 parent c66eefa commit 6dff7a9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
14 changes: 7 additions & 7 deletions add_path.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void bcp_implementation::add_directory(const fs::path& p)
if(!m_dependencies.count(np))
{
m_dependencies[np] = p; // set up dependency tree
add_path(np);
add_pending_path(np);
}
++i;
}
Expand Down Expand Up @@ -181,7 +181,7 @@ void bcp_implementation::add_file(const fs::path& p)
if(!m_dependencies.count(dep))
{
m_dependencies[dep] = p; // set up dependency tree
add_path(dep);
add_pending_path(dep);
}
}
++i;
Expand Down Expand Up @@ -292,7 +292,7 @@ static const std::pair<fs::path, fs::path>
if(!m_dependencies.count(specials[n].second))
{
m_dependencies[specials[n].second] = p; // set up dependency tree
add_path(specials[n].second);
add_pending_path(specials[n].second);
}
}
}
Expand Down Expand Up @@ -345,15 +345,15 @@ void bcp_implementation::add_file_dependencies(const fs::path& p, bool scanfile)
if(!m_dependencies.count(p.branch_path() / include_file))
{
m_dependencies[p.branch_path() / include_file] = p;
add_path(p.branch_path() / include_file);
add_pending_path(p.branch_path() / include_file);
}
}
else if(fs::exists(m_boost_path / include_file))
{
if(!m_dependencies.count(include_file))
{
m_dependencies[include_file] = p;
add_path(include_file);
add_pending_path(include_file);
}
}
++i;
Expand Down Expand Up @@ -395,15 +395,15 @@ void bcp_implementation::add_file_dependencies(const fs::path& p, bool scanfile)
if(!m_dependencies.count(p.branch_path() / include_file))
{
m_dependencies[p.branch_path() / include_file] = p;
add_path(p.branch_path() / include_file);
add_pending_path(p.branch_path() / include_file);
}
}
else if(fs::exists(m_boost_path / include_file))
{
if(!m_dependencies.count(include_file))
{
m_dependencies[include_file] = p;
add_path(include_file);
add_pending_path(include_file);
}
}
else
Expand Down
5 changes: 5 additions & 0 deletions bcp_imp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,11 @@ int bcp_implementation::run()
}
++i;
}
while (!m_pending_paths.empty())
{
add_path(m_pending_paths.front());
m_pending_paths.pop();
}
//
// now perform output:
//
Expand Down
3 changes: 3 additions & 0 deletions bcp_imp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <list>
#include <set>
#include <map>
#include <queue>
#include <boost/filesystem/path.hpp>

namespace fs = boost::filesystem;
Expand Down Expand Up @@ -74,6 +75,7 @@ class bcp_implementation
void scan_cvs_path(const fs::path& p);
void scan_svn_path(const fs::path& p);
void add_path(const fs::path& p);
void add_pending_path(const fs::path& p) { m_pending_paths.push(p); }
void add_directory(const fs::path& p);
void add_file(const fs::path& p);
void copy_path(const fs::path& p);
Expand Down Expand Up @@ -114,5 +116,6 @@ class bcp_implementation
std::string m_namespace_name; // namespace rename.
std::set<std::string> m_lib_names; // List of library binary names
std::map<std::string, fs::path> m_top_namespaces; // List of top level namespace names
std::queue<fs::path, std::list<fs::path> > m_pending_paths; // Queue of paths we haven't scanned yet.
};

0 comments on commit 6dff7a9

Please sign in to comment.