* cli/cli-cmds.c (edit_command): If symtab->fullname is not yet
set, use symtab_to_fullname, instead of trying to do its job. Use xstrprintf instead of malloc and sprintf.
This commit is contained in:
parent
46845f5e98
commit
a955ca7173
@ -1,3 +1,9 @@
|
|||||||
|
2005-04-28 Eli Zaretskii <eliz@gnu.org>
|
||||||
|
|
||||||
|
* cli/cli-cmds.c (edit_command): If symtab->fullname is not yet
|
||||||
|
set, use symtab_to_fullname, instead of trying to do its job. Use
|
||||||
|
xstrprintf instead of malloc and sprintf.
|
||||||
|
|
||||||
2005-04-28 Kevin Buettner <kevinb@redhat.com>
|
2005-04-28 Kevin Buettner <kevinb@redhat.com>
|
||||||
|
|
||||||
* remote.c (init_remote_state): Eliminate use of
|
* remote.c (init_remote_state): Eliminate use of
|
||||||
|
@ -554,7 +554,7 @@ edit_command (char *arg, int from_tty)
|
|||||||
int cmdlen, log10;
|
int cmdlen, log10;
|
||||||
unsigned m;
|
unsigned m;
|
||||||
char *editor;
|
char *editor;
|
||||||
char *p;
|
char *p, *fn;
|
||||||
|
|
||||||
/* Pull in the current default source line if necessary */
|
/* Pull in the current default source line if necessary */
|
||||||
if (arg == 0)
|
if (arg == 0)
|
||||||
@ -632,20 +632,21 @@ edit_command (char *arg, int from_tty)
|
|||||||
for(log10=32, m=0x80000000; !(sal.line & m) && log10>0; log10--, m=m>>1);
|
for(log10=32, m=0x80000000; !(sal.line & m) && log10>0; log10--, m=m>>1);
|
||||||
log10 = 1 + (int)((log10 + (0 == ((m-1) & sal.line)))/3.32192809);
|
log10 = 1 + (int)((log10 + (0 == ((m-1) & sal.line)))/3.32192809);
|
||||||
|
|
||||||
cmdlen = strlen(editor) + 1
|
/* If we don't already know the full absolute file name of the
|
||||||
+ (NULL == sal.symtab->dirname ? 0 : strlen(sal.symtab->dirname) + 1)
|
source file, find it now. */
|
||||||
+ (NULL == sal.symtab->filename? 0 : strlen(sal.symtab->filename)+ 1)
|
if (!sal.symtab->fullname)
|
||||||
+ log10 + 2;
|
{
|
||||||
|
fn = symtab_to_fullname (sal.symtab);
|
||||||
|
if (!fn)
|
||||||
|
fn = "unknown";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
fn = sal.symtab->fullname;
|
||||||
|
|
||||||
p = xmalloc(cmdlen);
|
/* Quote the file name, in case it has whitespace or other special
|
||||||
sprintf(p,"%s +%d %s%s",editor,sal.line,
|
characters. */
|
||||||
(NULL == sal.symtab->dirname ? "./" :
|
p = xstrprintf ("%s +%d \"%s\"", editor, sal.line, fn);
|
||||||
(NULL != sal.symtab->filename && *(sal.symtab->filename) != '/') ?
|
|
||||||
sal.symtab->dirname : ""),
|
|
||||||
(NULL == sal.symtab->filename ? "unknown" : sal.symtab->filename)
|
|
||||||
);
|
|
||||||
shell_escape(p, from_tty);
|
shell_escape(p, from_tty);
|
||||||
|
|
||||||
xfree(p);
|
xfree(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user