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] PR cli/21688: Fix multi-line/inline command differentiation


On 2017-06-30 00:21, Sergio Durigan Junior wrote:
On Thursday, June 29 2017, Simon Marchi wrote:

On 2017-06-29 21:48, Sergio Durigan Junior wrote:
On Thursday, June 29 2017, Simon Marchi wrote:
Another (maybe simpler) way would be to check

  else if (command_name_equals (cmd, "python") && *cmd_name == '\0')

It's not clear when expressed like this though because cmd_name is not
well named at this point (it points just after the command name).

Hm, right.  Would you prefer this way instead?  I don't have a strong
opinion on this.

My opinion is the solution with the least code is probably best, if
they are equivalent otherwise, but I don't really mind.  It's just a
suggestion.

Right.  I did some more tests here, and unfortunately your solution
doesn't work for all cases.  For example, if the user puts trailing
whitespace on the command name (like "python "), *cmd_name will point to
a whitespace after the call to lookup_cmd_1.

Ah, I got confused because there's some code that strips trailing whitespaces, but it only set p_end, it doesn't modify the string.

So here's second version of the patch, with the fixes you requested
except the one above.  WDYT?

That LGTM.

Simon


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