Skip to content

Commit

Permalink
clean: remove unnecessary Cleaner constructor variant
Browse files Browse the repository at this point in the history
`Cleaner` provides two constructors that are the same except that one
constructs a "real" disk interface internally and the other takes a
caller-provided disk interface.  A real disk interface is already
available at the only call site for the former constructor.  Use it
directly and drop the unnecessary constructor variant.
  • Loading branch information
bradking committed Apr 18, 2019
1 parent 2375707 commit c21f3f2
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 15 deletions.
10 changes: 0 additions & 10 deletions src/clean.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,6 @@
#include "state.h"
#include "util.h"

Cleaner::Cleaner(State* state, const BuildConfig& config)
: state_(state),
config_(config),
removed_(),
cleaned_(),
cleaned_files_count_(0),
disk_interface_(new RealDiskInterface),
status_(0) {
}

Cleaner::Cleaner(State* state,
const BuildConfig& config,
DiskInterface* disk_interface)
Expand Down
4 changes: 0 additions & 4 deletions src/clean.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,7 @@ struct Rule;
struct DiskInterface;

struct Cleaner {
/// Build a cleaner object with a real disk interface.
Cleaner(State* state, const BuildConfig& config);

/// Build a cleaner object with the given @a disk_interface
/// (Useful for testing).
Cleaner(State* state,
const BuildConfig& config,
DiskInterface* disk_interface);
Expand Down
2 changes: 1 addition & 1 deletion src/ninja.cc
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ int NinjaMain::ToolClean(const Options* options, int argc, char* argv[]) {
return 1;
}

Cleaner cleaner(&state_, config_);
Cleaner cleaner(&state_, config_, &disk_interface_);
if (argc >= 1) {
if (clean_rules)
return cleaner.CleanRules(argc, argv);
Expand Down

0 comments on commit c21f3f2

Please sign in to comment.