[binutils-gdb] [gdb] Check strpbrk against nullptr
Tom de Vries
vries@sourceware.org
Mon Mar 31 14:12:17 GMT 2025
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=80a7eb6ac7d6661b06e014329cac101e83d2003c
commit 80a7eb6ac7d6661b06e014329cac101e83d2003c
Author: Tom de Vries <tdevries@suse.de>
Date: Mon Mar 31 16:12:22 2025 +0200
[gdb] Check strpbrk against nullptr
In noticed two occurrences of "if (strpbrk (...))".
Fix this style issue by checking against nullptr.
Diff:
---
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;
More information about the Gdb-cvs
mailing list