Skip to content

Commit 58cbad6

Browse files
committed
Revert "Introduce function IsNullTerminated"
This reverts commit 6827079.
1 parent 8e9305e commit 58cbad6

File tree

2 files changed

+1
-8
lines changed

2 files changed

+1
-8
lines changed

flang-rt/include/flang-rt/runtime/tools.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -525,9 +525,6 @@ RT_API_ATTRS void ShallowCopy(const Descriptor &to, const Descriptor &from,
525525
bool toIsContiguous, bool fromIsContiguous);
526526
RT_API_ATTRS void ShallowCopy(const Descriptor &to, const Descriptor &from);
527527

528-
// Determines if a character string is null-terminated.
529-
RT_API_ATTRS bool IsNullTerminated(char *str, std::size_t length);
530-
531528
// Ensures that a character string is null-terminated, allocating a /p length +1
532529
// size memory for null-terminator if necessary. Returns the original or a newly
533530
// allocated null-terminated string (responsibility for deallocation is on the

flang-rt/lib/runtime/tools.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -273,13 +273,9 @@ RT_API_ATTRS void ShallowCopy(const Descriptor &to, const Descriptor &from) {
273273
ShallowCopy(to, from, to.IsContiguous(), from.IsContiguous());
274274
}
275275

276-
RT_API_ATTRS bool IsNullTerminated(char *str, std::size_t length) {
277-
return !(runtime::memchr(str, '\0', length) == nullptr);
278-
}
279-
280276
RT_API_ATTRS char *EnsureNullTerminated(
281277
char *str, std::size_t length, Terminator &terminator) {
282-
if (!IsNullTerminated(str, length)) {
278+
if (runtime::memchr(str, '\0', length) == nullptr) {
283279
char *newCmd{(char *)AllocateMemoryOrCrash(terminator, length + 1)};
284280
runtime::memcpy(newCmd, str, length);
285281
newCmd[length] = '\0';

0 commit comments

Comments
 (0)