From 80a7eb6ac7d6661b06e014329cac101e83d2003c Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Mon, 31 Mar 2025 16:12:22 +0200 Subject: [PATCH] [gdb] Check strpbrk against nullptr In noticed two occurrences of "if (strpbrk (...))". Fix this style issue by checking against nullptr. --- gdb/go32-nat.c | 2 +- gdbsupport/common-inferior.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c index 84533669b53..7852f5653f9 100644 --- a/gdb/go32-nat.c +++ b/gdb/go32-nat.c @@ -697,7 +697,7 @@ go32_nat_target::create_inferior (const char *exec_file, "not enough memory.\n")); /* Parse the command line and create redirections. */ - if (strpbrk (args, "<>")) + if (strpbrk (args, "<>") != nullptr) { if (redir_cmdline_parse (args, &child_cmd) == 0) args = child_cmd.command; diff --git a/gdbsupport/common-inferior.cc b/gdbsupport/common-inferior.cc index e544780bd4b..d2fd348fe07 100644 --- a/gdbsupport/common-inferior.cc +++ b/gdbsupport/common-inferior.cc @@ -59,7 +59,7 @@ escape_characters (const char *arg, const char *special) #ifdef __MINGW32__ bool quoted = false; - if (strpbrk (arg, special)) + if (strpbrk (arg, special) != nullptr) { quoted = true; result += quote; -- 2.39.5