Skip to content

Commit 2ed30b3

Browse files
tniessenCeres6
authored andcommitted
permission: move PrintTree into unnamed namespace
This function is not declared outside of fs_permission.cc and thus should not be visible outside the file during the linking stage. PR-URL: nodejs#48874 Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Debadree Chatterjee <debadree333@gmail.com>
1 parent ecee4c4 commit 2ed30b3

File tree

1 file changed

+29
-28
lines changed

1 file changed

+29
-28
lines changed

src/permission/fs_permission.cc

+29-28
Original file line numberDiff line numberDiff line change
@@ -67,52 +67,53 @@ bool is_tree_granted(node::permission::FSPermission::RadixTree* granted_tree,
6767
return granted_tree->Lookup(param, true);
6868
}
6969

70-
} // namespace
71-
72-
namespace node {
73-
74-
namespace permission {
75-
76-
void PrintTree(const FSPermission::RadixTree::Node* node, size_t spaces = 0) {
70+
void PrintTree(const node::permission::FSPermission::RadixTree::Node* node,
71+
size_t spaces = 0) {
7772
std::string whitespace(spaces, ' ');
7873

7974
if (node == nullptr) {
8075
return;
8176
}
8277
if (node->wildcard_child != nullptr) {
83-
per_process::Debug(DebugCategory::PERMISSION_MODEL,
84-
"%s Wildcard: %s\n",
85-
whitespace,
86-
node->prefix);
78+
node::per_process::Debug(node::DebugCategory::PERMISSION_MODEL,
79+
"%s Wildcard: %s\n",
80+
whitespace,
81+
node->prefix);
8782
} else {
88-
per_process::Debug(DebugCategory::PERMISSION_MODEL,
89-
"%s Prefix: %s\n",
90-
whitespace,
91-
node->prefix);
83+
node::per_process::Debug(node::DebugCategory::PERMISSION_MODEL,
84+
"%s Prefix: %s\n",
85+
whitespace,
86+
node->prefix);
9287
if (node->children.size()) {
9388
size_t child = 0;
9489
for (const auto& pair : node->children) {
9590
++child;
96-
per_process::Debug(DebugCategory::PERMISSION_MODEL,
97-
"%s Child(%s): %s\n",
98-
whitespace,
99-
child,
100-
std::string(1, pair.first));
91+
node::per_process::Debug(node::DebugCategory::PERMISSION_MODEL,
92+
"%s Child(%s): %s\n",
93+
whitespace,
94+
child,
95+
std::string(1, pair.first));
10196
PrintTree(pair.second, spaces + 2);
10297
}
103-
per_process::Debug(DebugCategory::PERMISSION_MODEL,
104-
"%s End of tree - child(%s)\n",
105-
whitespace,
106-
child);
98+
node::per_process::Debug(node::DebugCategory::PERMISSION_MODEL,
99+
"%s End of tree - child(%s)\n",
100+
whitespace,
101+
child);
107102
} else {
108-
per_process::Debug(DebugCategory::PERMISSION_MODEL,
109-
"%s End of tree: %s\n",
110-
whitespace,
111-
node->prefix);
103+
node::per_process::Debug(node::DebugCategory::PERMISSION_MODEL,
104+
"%s End of tree: %s\n",
105+
whitespace,
106+
node->prefix);
112107
}
113108
}
114109
}
115110

111+
} // namespace
112+
113+
namespace node {
114+
115+
namespace permission {
116+
116117
// allow = '*'
117118
// allow = '/tmp/,/home/example.js'
118119
void FSPermission::Apply(const std::string& allow, PermissionScope scope) {

0 commit comments

Comments
 (0)