[PATCH] D61326: Fixes for builds that require strict X/Open and POSIX compatiblity
Hubert Tong via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu May 2 16:50:46 PDT 2019
hubert.reinterpretcast added inline comments.
================
Comment at: llvm/lib/Support/Unix/Memory.inc:111
+#if defined(MAP_ANON)
+ | MAP_ANON
+#endif
----------------
I think using `MMFlags |= MAP_ANON;` will help readability/maintainability.
================
Comment at: llvm/lib/Support/Unix/Memory.inc:146
+#if !defined(MAP_ANON)
+ close(fd);
+#endif
----------------
If it's okay to close the file here, then it is okay to close the file right after the call to `mmap` before checking whether `mmap` failed. We would only need to add one call to `close` (instead of three).
================
Comment at: llvm/lib/Support/Unix/Path.inc:156
return nullptr;
- s = pv = strdup(pv);
- if (!pv)
+ s = strdup(pv);
+ if (!s)
----------------
If we're going to move where the `pv`, etc. is declared, then we might as well move the declaration of `s` to this line...
================
Comment at: llvm/lib/Support/Unix/Path.inc:160
+ char *state;
+ if ((t = strtok_r(s, ":", &state)) != nullptr) {
+ do {
----------------
... and declare `t` in the `if`:
```
if (char *t = strtok_r(s, ":", &state)) {
```
Repository:
rL LLVM
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D61326/new/
https://reviews.llvm.org/D61326
More information about the llvm-commits
mailing list