[flang-commits] [flang] FDATE extension implementation: get date and time in ctime format (PR #71222)

David Truby via flang-commits flang-commits at lists.llvm.org
Thu Nov 9 08:55:16 PST 2023


================
@@ -125,6 +126,33 @@ static bool FitsInDescriptor(
       kind, terminator, value);
 }
 
+void removeNewLine(char *str) {
+  char *newlinePos = strchr(str, '\n');
+  if (newlinePos != NULL) {
----------------
DavidTruby wrote:

Use nullptr instead of NULL.
Alternatively in this case you can just do:
`if (newlinePos) {`. This is idiomatic in C/C++ for checking pointer validity

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


More information about the flang-commits mailing list