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]

Re: [PATCH 1/6] New function null_stream


On 01/18/2017 08:45 AM, Yao Qi wrote:
On 17-01-17 07:49:07, Luis Machado wrote:

+struct ui_file *
+null_stream (void)
+{
+  static struct ui_file *stream = NULL;
+
+  if (stream == NULL)
+    {
+      stream = ui_file_new ();
+      make_final_cleanup (do_ui_file_delete, stream);
+    }

Since we're explicitly setting stream to NULL, we will always
execute the conditional block, so it is not needed. Unless this is
supposed to reuse a stream, but in that case the code would be
incorrect.


It is a reused null stream.  Different parts of gdb can use it.  Why
is it incorrect?


We're setting stream to NULL at the top of the function and then checking if it is NULL (it obviously is) right after that? Am i missing something?


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