This is the mail archive of the gdb-patches@sources.redhat.com 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: Minor off-by-one error in command_line_handler


Elena Zannoni <ezannoni@redhat.com> writes:

|> Andreas Schwab writes:
|>  > 
|>  > Btw., command_line_handler has this:
|>  > 
|>  > 
|>  >   if (*(p - 1) == '\\')
|>  >     {
|>  >       p--;			/* Put on top of '\'.  */
|>  > 
|>  >       if (*p == '\\')
|>  > 
|>  > The condition in the last line is always true.
|>  > 
|> 
|> Yes, thanks for catching this. Would you like to submit a fix?

I've checked this in as being obvious.

2002-03-27  Andreas Schwab  <schwab@suse.de>

	* event-top.c (command_line_handler): Remove useless if.

--- gdb/event-top.c.~1.19.~	2002-01-18 09:37:57.000000000 +0100
+++ gdb/event-top.c	2002-03-27 22:12:23.000000000 +0100
@@ -685,20 +685,17 @@
     {
       p--;			/* Put on top of '\'.  */
 
-      if (*p == '\\')
-	{
-	  readline_input_state.linebuffer = savestring (linebuffer,
-							strlen (linebuffer));
-	  readline_input_state.linebuffer_ptr = p;
-
-	  /* We will not invoke a execute_command if there is more
-	     input expected to complete the command. So, we need to
-	     print an empty prompt here. */
-	  more_to_come = 1;
-	  push_prompt ("", "", "");
-	  display_gdb_prompt (0);
-	  return;
-	}
+      readline_input_state.linebuffer = savestring (linebuffer,
+						    strlen (linebuffer));
+      readline_input_state.linebuffer_ptr = p;
+
+      /* We will not invoke a execute_command if there is more
+	 input expected to complete the command. So, we need to
+	 print an empty prompt here. */
+      more_to_come = 1;
+      push_prompt ("", "", "");
+      display_gdb_prompt (0);
+      return;
     }
 
 #ifdef STOP_SIGNAL

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE GmbH, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


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