[PATCH] D114337: Support Windows

Danila Malyutin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 21 07:36:01 PST 2021


danilaml added inline comments.


================
Comment at: lnt/testing/profile/cPerf.cpp:63
+#define strtok_r strtok_s
+#include <windows.h>
+#include <BaseTsd.h>
----------------
Would it work with lean and mean macro defined? It's preferable, if it would.


================
Comment at: lnt/testing/profile/cPerf.cpp:140
+#ifdef _WIN32
+size_t getline(char** lineptr, size_t* n, FILE* stream) {
+  if (lineptr == nullptr || stream == nullptr || n == nullptr) return -1;
----------------
shouldn't it return `ssize_t`?


================
Comment at: lnt/testing/profile/cPerf.cpp:154
+  while (c != EOF) {
+    if ((unsigned)(p - bufptr) > (size - 1)) {
+      size = size + 128;
----------------
Why cast to `unsigned`? What if `size == 0`?


================
Comment at: lnt/testing/profile/cPerf.cpp:405
       ssize_t Len = getline(&Line, &LineLen, Stream);
       if (Len == -1)
         break;
----------------
I think there is a potential mem leak here, but that's not critical.


Repository:
  rLNT LNT

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114337/new/

https://reviews.llvm.org/D114337



More information about the llvm-commits mailing list