Skip to content

Commit

Permalink
fix: virtual destructor warning
Browse files Browse the repository at this point in the history
  • Loading branch information
EmperorYP7 committed Sep 5, 2023
1 parent c49bcfd commit 7ebd848
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ MigrationBackup/
cmake-build/
xcode-build/
cmake-build*/
build_support/

# pip
*.egg-info
Expand Down
4 changes: 2 additions & 2 deletions casbin/persist/adapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
namespace casbin {

// LoadPolicyLine loads a text line as a policy rule to model.
void LoadPolicyLine(std::string line, const std::shared_ptr<Model>& model) {
if (line == "" || line.find("#") == 0)
void LoadPolicyLine(const std::string& line, const std::shared_ptr<Model>& model) {
if (line.empty() || line.find('#') == 0)
return;

std::vector<std::string> tokens = Split(line, ",", -1);
Expand Down
4 changes: 3 additions & 1 deletion casbin/persist/adapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
namespace casbin {

// LoadPolicyLine loads a text line as a policy rule to model.
void LoadPolicyLine(std::string line, const std::shared_ptr<Model>& model);
void LoadPolicyLine(const std::string& line, const std::shared_ptr<Model>& model);

/**
* Adapter is the interface for Casbin adapters.
Expand All @@ -34,6 +34,8 @@ class Adapter {
public:
bool filtered;

virtual ~Adapter() = default;

/**
* LoadPolicy loads all policy rules from the storage.
*
Expand Down
4 changes: 3 additions & 1 deletion include/casbin/persist/adapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
namespace casbin {

// LoadPolicyLine loads a text line as a policy rule to model.
void LoadPolicyLine(std::string line, const std::shared_ptr<Model>& model);
void LoadPolicyLine(const std::string& line, const std::shared_ptr<Model>& model);

/**
* Adapter is the interface for Casbin adapters.
Expand All @@ -34,6 +34,8 @@ class Adapter {
public:
bool filtered;

virtual ~Adapter() = default;

/**
* LoadPolicy loads all policy rules from the storage.
*
Expand Down

0 comments on commit 7ebd848

Please sign in to comment.