Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 3 May 2025 15:59:14 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 26d4ac7a2725 - main - kyua: Don't pass NULL to unique_ptr constructors
Message-ID:  <202505031559.543FxEgp021079@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=26d4ac7a2725c0ab2d536c402fc0185fe7afed85

commit 26d4ac7a2725c0ab2d536c402fc0185fe7afed85
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2025-05-03 15:58:47 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2025-05-03 15:58:47 +0000

    kyua: Don't pass NULL to unique_ptr constructors
    
    This is ambiguous when NULL is defined to an integral constant.
    Instead, use the more iodiomatic pattern of {} to construct a default
    pointer.
    
    Reviewed by:    olce
    Differential Revision:  https://reviews.freebsd.org/D50090
---
 contrib/kyua/utils/process/child.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/contrib/kyua/utils/process/child.cpp b/contrib/kyua/utils/process/child.cpp
index bfde8159d5c8..d554f1fd9fb5 100644
--- a/contrib/kyua/utils/process/child.cpp
+++ b/contrib/kyua/utils/process/child.cpp
@@ -223,7 +223,7 @@ process::child::fork_capture_aux(void)
             std::cerr << F("Failed to set up subprocess: %s\n") % e.what();
             std::abort();
         }
-        return std::unique_ptr< process::child >(NULL);
+        return {};
     } else {
         ::close(fds[1]);
         LD(F("Spawned process %s: stdout and stderr inherited") % pid);
@@ -284,7 +284,7 @@ process::child::fork_files_aux(const fs::path& stdout_file,
             std::cerr << F("Failed to set up subprocess: %s\n") % e.what();
             std::abort();
         }
-        return std::unique_ptr< process::child >(NULL);
+        return {};
     } else {
         LD(F("Spawned process %s: stdout=%s, stderr=%s") % pid % stdout_file %
            stderr_file);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202505031559.543FxEgp021079>