Mercurial > hg > octave-lyh
changeset 3524:ee1eea24f078
[project @ 2000-02-02 10:31:05 by jwe]
author | jwe |
---|---|
date | Wed, 02 Feb 2000 10:31:05 +0000 |
parents | b80bbb43a1a9 |
children | 6cfa474c5b99 |
files | liboctave/oct-rl-hist.c |
diffstat | 1 files changed, 6 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/oct-rl-hist.c +++ b/liboctave/oct-rl-hist.c @@ -206,16 +206,14 @@ k = 0; for (i = beg; i < end; i++) { - char *tmp = 0; - char buf[64]; + char *line = hlist[i]->line; + int len = line ? strlen (line) : 0; + char *tmp = malloc (len + 64); if (number_lines) - sprintf (buf, "%5d%c", i + history_base, - hlist[i]->data ? '*' : ' '); - - tmp = malloc (strlen (buf) + 1); - - strcpy (tmp, buf); + sprintf (tmp, "%5d%c%s", i + history_base, + hlist[i]->data ? '*' : ' ' + line ? line : ""); retval[k++] = tmp; }