Oops, free foo and don't allocate it every time throught the loop
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@269 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
ec58a99326
commit
3b0d14444f
6
files.c
6
files.c
|
@ -608,6 +608,7 @@ int input_tab(char *buf, int place, int lastWasTab)
|
||||||
static char **matches = (char **) NULL;
|
static char **matches = (char **) NULL;
|
||||||
int pos = place, newplace = 0, i = 0, col = 0, editline = 0;
|
int pos = place, newplace = 0, i = 0, col = 0, editline = 0;
|
||||||
int longestname = 0;
|
int longestname = 0;
|
||||||
|
char *foo;
|
||||||
|
|
||||||
if (lastWasTab == FALSE) {
|
if (lastWasTab == FALSE) {
|
||||||
char *tmp, *matchBuf;
|
char *tmp, *matchBuf;
|
||||||
|
@ -704,13 +705,13 @@ int input_tab(char *buf, int place, int lastWasTab)
|
||||||
if (longestname > COLS - 1)
|
if (longestname > COLS - 1)
|
||||||
longestname = COLS - 1;
|
longestname = COLS - 1;
|
||||||
|
|
||||||
|
foo = nmalloc(longestname + 5);
|
||||||
|
|
||||||
/* Print the list of matches */
|
/* Print the list of matches */
|
||||||
for (i = 0, col = 0; i < num_matches; i++) {
|
for (i = 0, col = 0; i < num_matches; i++) {
|
||||||
|
|
||||||
/* make each filename shown be the same length as the longest
|
/* make each filename shown be the same length as the longest
|
||||||
filename, with two spaces at the end */
|
filename, with two spaces at the end */
|
||||||
char *foo;
|
|
||||||
foo = nmalloc(longestname + 5);
|
|
||||||
snprintf(foo, longestname + 1, matches[i]);
|
snprintf(foo, longestname + 1, matches[i]);
|
||||||
while (strlen(foo) < longestname)
|
while (strlen(foo) < longestname)
|
||||||
strcat(foo, " ");
|
strcat(foo, " ");
|
||||||
|
@ -724,6 +725,7 @@ int input_tab(char *buf, int place, int lastWasTab)
|
||||||
col = 0;
|
col = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
free(foo);
|
||||||
wrefresh(edit);
|
wrefresh(edit);
|
||||||
num_matches = 0;
|
num_matches = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
msgid ""
|
msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"POT-Creation-Date: 2000-11-05 16:52-0500\n"
|
"POT-Creation-Date: 2000-11-05 16:56-0500\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
|
Loading…
Reference in New Issue