From 8fbc3c1179e061e45f9da278d15d8adf489148a0 Mon Sep 17 00:00:00 2001 From: Siva Chandra Reddy Date: Mon, 25 Jul 2022 20:45:46 +0000 Subject: [PATCH] [libc][Obvious] Use the correct StringView constructor in dirent_test. --- libc/test/src/dirent/dirent_test.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/libc/test/src/dirent/dirent_test.cpp b/libc/test/src/dirent/dirent_test.cpp index 6826c28..f88122f 100644 --- a/libc/test/src/dirent/dirent_test.cpp +++ b/libc/test/src/dirent/dirent_test.cpp @@ -27,18 +27,19 @@ TEST(LlvmLibcDirentTest, SimpleOpenAndRead) { // greater than 2. ASSERT_GT(__llvm_libc::dirfd(dir), 2); - struct ::dirent *file1, *file2, *dir1, *dir2; + struct ::dirent *file1 = nullptr, *file2 = nullptr, *dir1 = nullptr, + *dir2 = nullptr; while (true) { struct ::dirent *d = __llvm_libc::readdir(dir); if (d == nullptr) break; - if (StringView(d->d_name).equals("file1.txt")) + if (StringView(&d->d_name[0]).equals("file1.txt")) file1 = d; - if (StringView(d->d_name).equals("file2.txt")) + if (StringView(&d->d_name[0]).equals("file2.txt")) file2 = d; - if (StringView(d->d_name).equals("dir1")) + if (StringView(&d->d_name[0]).equals("dir1")) dir1 = d; - if (StringView(d->d_name).equals("dir2.txt")) + if (StringView(&d->d_name[0]).equals("dir2")) dir2 = d; } -- 2.7.4