]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb] Check strpbrk against nullptr
authorTom de Vries <tdevries@suse.de>
Mon, 31 Mar 2025 14:12:22 +0000 (16:12 +0200)
committerTom de Vries <tdevries@suse.de>
Mon, 31 Mar 2025 14:12:22 +0000 (16:12 +0200)
In noticed two occurrences of "if (strpbrk (...))".

Fix this style issue by checking against nullptr.

gdb/go32-nat.c
gdbsupport/common-inferior.cc

index 84533669b53b044995d0f73f55d95bd5c558360b..7852f5653f9b289a3272c8612025f3dc99278a4b 100644 (file)
@@ -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;
index e544780bd4b4eb5c9cf21518fd6449de3f7274a9..d2fd348fe077473687a12bf620e52e0e5244c1e5 100644 (file)
@@ -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;