[flang-commits] [flang] [flang] add SYSTEM runtime and lowering intrinsics support (PR #74309)

Yi Wu via flang-commits flang-commits at lists.llvm.org
Thu Dec 14 09:13:58 PST 2023


================
@@ -282,4 +282,40 @@ std::int32_t RTNAME(GetEnvVariable)(const Descriptor &name,
   return StatOk;
 }
 
+const char *ensureNullTerminated(
+    const char *str, size_t length, Terminator &terminator) {
+  if (length <= strlen(str)) {
+    char *newCmd{(char *)malloc(length + 1)};
+    if (newCmd == NULL) {
+      terminator.Crash("Command not null-terminated, memory allocation failed "
+                       "for null-terminated newCmd.");
+    }
+
+    strncpy(newCmd, str, length);
----------------
yi-wu-arm wrote:

Done

https://github.com/llvm/llvm-project/pull/74309


More information about the flang-commits mailing list