constify command docs
This makes the command "doc" parameter const. 2014-07-24 Tom Tromey <tromey@redhat.com> * cli/cli-decode.c (add_cmd, add_prefix_cmd) (add_abbrev_prefix_cmd, add_set_or_show_cmd, add_info) (add_info_alias, add_com): Make "doc" const. (print_doc_line): Make "str" const. (delete_cmd): Update. * cli/cli-decode.h (struct cmd_list_element) <doc>: Now const. (print_doc_line): Update. * cli/cli-script.c (document_command): Update. * command.h (add_cmd, add_prefix_cmd, add_abbrev_prefix_cmd) (add_com, add_info, add_info_alias): Update. * guile/scm-cmd.c (cmdscm_destroyer): Update. * python/py-cmd.c (cmdpy_destroyer): Update.
This commit is contained in:
parent
64e61d290e
commit
1947513d92
8 changed files with 45 additions and 26 deletions
|
@ -1611,24 +1611,27 @@ document_command (char *comname, int from_tty)
|
|||
doclines = read_command_lines (tmpbuf, from_tty, 0, 0, 0);
|
||||
|
||||
if (c->doc)
|
||||
xfree (c->doc);
|
||||
xfree ((char *) c->doc);
|
||||
|
||||
{
|
||||
struct command_line *cl1;
|
||||
int len = 0;
|
||||
char *doc;
|
||||
|
||||
for (cl1 = doclines; cl1; cl1 = cl1->next)
|
||||
len += strlen (cl1->line) + 1;
|
||||
|
||||
c->doc = (char *) xmalloc (len + 1);
|
||||
*c->doc = 0;
|
||||
doc = (char *) xmalloc (len + 1);
|
||||
*doc = 0;
|
||||
|
||||
for (cl1 = doclines; cl1; cl1 = cl1->next)
|
||||
{
|
||||
strcat (c->doc, cl1->line);
|
||||
strcat (doc, cl1->line);
|
||||
if (cl1->next)
|
||||
strcat (c->doc, "\n");
|
||||
strcat (doc, "\n");
|
||||
}
|
||||
|
||||
c->doc = doc;
|
||||
}
|
||||
|
||||
free_command_lines (&doclines);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue