From e948bec969e6a225b5af01d1d900fcc0e84bfcd1 Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Sat, 29 Apr 2023 10:04:57 -0400 Subject: [PATCH] src: avoid copying string in fs_permission PR-URL: https://github.com/nodejs/node/pull/47746 Reviewed-By: Rafael Gonzaga Reviewed-By: Daeyeon Jeong Reviewed-By: Luigi Pinca Reviewed-By: Deokjin Kim Reviewed-By: Darshan Sen --- src/permission/fs_permission.cc | 2 +- src/permission/fs_permission.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/permission/fs_permission.cc b/src/permission/fs_permission.cc index 05efc790f0c853..7a8a0ba2511d4b 100644 --- a/src/permission/fs_permission.cc +++ b/src/permission/fs_permission.cc @@ -89,7 +89,7 @@ void FSPermission::Apply(const std::string& allow, PermissionScope scope) { } } -void FSPermission::GrantAccess(PermissionScope perm, std::string res) { +void FSPermission::GrantAccess(PermissionScope perm, const std::string& res) { const std::string path = WildcardIfDir(res); if (perm == PermissionScope::kFileSystemRead) { granted_in_fs_.Insert(path); diff --git a/src/permission/fs_permission.h b/src/permission/fs_permission.h index 93c427276139fd..f393c6a042e662 100644 --- a/src/permission/fs_permission.h +++ b/src/permission/fs_permission.h @@ -130,7 +130,7 @@ class FSPermission final : public PermissionBase { }; private: - void GrantAccess(PermissionScope scope, std::string param); + void GrantAccess(PermissionScope scope, const std::string& param); void RestrictAccess(PermissionScope scope, const std::vector& params); // fs granted on startup