[PATCH] Support: Provide a function to get the home directory of an arbitrary user
David Majnemer
david.majnemer at gmail.com
Fri Aug 1 00:38:34 PDT 2014
================
Comment at: lib/Support/Unix/Path.inc:683
@@ +682,3 @@
+ result.clear();
+ struct passwd *user_entry = ::getpwnam (user.c_str());
+ if (user_entry == nullptr)
----------------
Reid Kleckner wrote:
> StringRef doesn't have a c_str() method, but you can do .str().c_str() to convert to std::string first. *yawn*, excessive copies in C++. :(
This doesn't follow LLVM's coding style.
Variables should be CamelCase and there is no space between the identifier and the parenthesis.
================
Comment at: lib/Support/Windows/Path.inc:873
@@ +872,3 @@
+ char sid_buf[SECURITY_MAX_SID_SIZE];
+ SID* sid = reinterpret_cast<SID*>(sid_buf);
+ DWORD sid_size = SECURITY_MAX_SID_SIZE;
----------------
Pointers on the right side.
================
Comment at: lib/Support/Windows/Path.inc:890
@@ +889,3 @@
+
+ domain_buffer.resize(cch_referenced_domain);
+ if (!::LookupAccountName(nullptr, user.data(), sid, &sid_size, &domain_buffer[0], &cch_referenced_domain, &sid_name_use))
----------------
Can we get away with using `reserve` instead of `resize`?
http://reviews.llvm.org/D4749
More information about the llvm-commits
mailing list