On Thursday 14 January 2010 16:37:42 Pedro Alves wrote: > > Or do you refer to some other function? > > -Usage: set inferior-tty /dev/pts/1"), NULL, NULL, &setlist, &showlist); > +Usage: set inferior-tty /dev/pts/1"), > + notice_inferior_io_terminal_set, > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > + show_inferior_io_terminal, > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > + &setlist, &showlist); > add_com_alias ("tty", "set inferior-tty", class_alias, 0); > > Better choices would be: set_inferior_tty_command/show_inferior_tty_command > or set_inferior_tty/show_inferior_tty. Done. Also done for args function. > > -char * > > +/* Set the arguments for the current inferior. Ownership of > > + NEWARGS is not transferred. */ > > + > > +void > > set_inferior_args (char *newargs) > > { > > - char *saved_args = inferior_args; > > - > > - inferior_args = newargs; > > - inferior_argc = 0; > > - inferior_argv = 0; > > - > > - return saved_args; > > + xfree (current_inferior ()->args); > > > + current_inferior ()->args = xstrdup (newargs ? newargs : ""); > > This never leaves NULL args. I guess it could. Done so. > > @@ -87,6 +88,10 @@ free_inferior (struct inferior *inf) > > { > > discard_all_inferior_continuations (inf); > > inferior_free_data (inf); > > + xfree (inf->args); > > > + xfree (inf->argv); > > Hmm, I was going to say that this usually leaks argv[0..argc], and > you should use freeargv, but, I now see that the only caller > of set_inferior_args_vector is captured_main, and the > argc,argv are presently a shallow copy of `main's arguments, so > definitely not ok to free this as is. This definitely needs a > comment in the description of inferior->argv, expanded from > the comment that was in inferior_argv. I've added a comment. - Volodya