files.c:cwd_tab_completion(), input_tab(): Changed bare malloc/calloc calls to nmalloc (found by Rocco).

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@478 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Chris Allegretta 2001-01-15 02:26:12 +00:00
parent 2be96d00b9
commit a35ec048d7
2 changed files with 4 additions and 2 deletions

View File

@ -26,6 +26,8 @@ General
Neil Parks). Neil Parks).
do_browser() do_browser()
- Added space and - keys to do page up and down. - Added space and - keys to do page up and down.
cwd_tab_completion(), input_tab()
- Changed bare malloc/calloc calls to nmalloc (found by Rocco).
- nano.c: - nano.c:
ABCD() ABCD()
- New function, figures out what kbinput to return given - New function, figures out what kbinput to return given

View File

@ -796,7 +796,7 @@ char **cwd_tab_completion(char *buf, int *num_matches)
/* Okie, if there's a / in the buffer, strip out the directory part */ /* Okie, if there's a / in the buffer, strip out the directory part */
if (strcmp(buf, "") && strstr(buf, "/")) { if (strcmp(buf, "") && strstr(buf, "/")) {
dirName = malloc(strlen(buf) + 1); dirName = nmalloc(strlen(buf) + 1);
tmp = buf + strlen(buf); tmp = buf + strlen(buf);
while (*tmp != '/' && tmp != buf) while (*tmp != '/' && tmp != buf)
tmp--; tmp--;
@ -882,7 +882,7 @@ char *input_tab(char *buf, int place, int *lastWasTab, int *newplace)
/* Make a local copy of the string -- up to the position of the /* Make a local copy of the string -- up to the position of the
cursor */ cursor */
matchBuf = (char *) calloc(strlen(buf) + 2, sizeof(char)); matchBuf = (char *) nmalloc((strlen(buf) + 2) * sizeof(char));
strncpy(matchBuf, buf, place); strncpy(matchBuf, buf, place);
tmp = matchBuf; tmp = matchBuf;