[PATCH] Add getenv() wrapper that works on multibyte environment variable.

Rui Ueyama ruiu at google.com
Tue Sep 10 12:24:07 PDT 2013



================
Comment at: lib/Support/Windows/Process.inc:162
@@ +161,3 @@
+    // Try again with larger buffer.
+    Buf.resize(Buf.size() * 2);
+  }
----------------
Reid Kleckner wrote:
> Can this be Size + 1?
Yes it can. There's still no guarantee that the buffer is large enough, as other threads can mutate the environment variable while this code is being executed, so we need to iterate though.

================
Comment at: lib/Support/Windows/Windows.h:144
@@ -139,1 +143,3 @@
 
+static llvm::error_code UTF8ToUTF16(llvm::StringRef utf8,
+				    llvm::SmallVectorImpl<wchar_t> &utf16) {
----------------
Reid Kleckner wrote:
> I'd rather leave these out-of-line defined in Path.inc, with declarations here, in some namespace under llvm::, since UTF8ToUTF16 is a common symbol in other codebases.
OK, I'll move this to Path.inc in llvm::sys::windows. I don't think Path.inc is the best place to put the code but I don't come up with other places.


http://llvm-reviews.chandlerc.com/D1612

BRANCH
  mbenv

ARCANIST PROJECT
  llvm



More information about the llvm-commits mailing list