This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH v12 13/32] Code cleanup: openp parameter filename_opened is never NULL


Hi,

this parameter is never passed as NULL in the codebase so the check can be
removed.

Jan


gdb/ChangeLog
2015-08-18  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* source.c (openp): Update function comment for filename_opened.
	Remove NULL check for filename_opened.
---
 0 files changed

diff --git a/gdb/source.c b/gdb/source.c
index 8dfe580..4096d0d 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -742,7 +742,7 @@ dirnames_to_char_ptr_vec_target_exc (const char *string)
 
    OPTS specifies the function behaviour in specific cases.
 
-   If FILENAME_OPENED is non-null, set it to a newly allocated string naming
+   FILENAME_OPENED must be non-null.  Set it to a newly allocated string naming
    the actual file opened (this string will always start with a "/").  We
    have to take special pains to avoid doubling the "/" between the directory
    and the file, sigh!  Emacs gets confuzzed by this when we print the
@@ -901,13 +901,10 @@ openp (const char *path, enum openp_flags opts, const char *string,
   do_cleanups (back_to);
 
 done:
-  if (filename_opened)
-    {
-      if (fd < 0)
-	*filename_opened = NULL;
-      else
-	*filename_opened = xstrdup (filename);
-    }
+  if (fd < 0)
+    *filename_opened = NULL;
+  else
+    *filename_opened = xstrdup (filename);
 
   return fd;
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]