aboutsummaryrefslogtreecommitdiffstats
path: root/noice.c
diff options
context:
space:
mode:
authorsin <sin@2f30.org>2016-02-08 16:57:56 +0000
committersin <sin@2f30.org>2016-02-08 17:00:15 +0000
commit35ca388e9d12db68f3e6a566b051a968489dea8e (patch)
treec6781ce087c9e1c46e1b666cb790811244db1fc3 /noice.c
parent9f6d1cfb334d7268608e04379400ce8bbe0429c9 (diff)
downloadnoice-35ca388e9d12db68f3e6a566b051a968489dea8e.tar.gz
Remove some more useless memory allocations
Diffstat (limited to 'noice.c')
-rw-r--r--noice.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/noice.c b/noice.c
index 2b000ad..fa773b0 100644
--- a/noice.c
+++ b/noice.c
@@ -341,7 +341,7 @@ nextsel(char **run, char **env)
char *
readln(void)
{
- char ln[LINE_MAX];
+ static char ln[LINE_MAX];
timeout(-1);
echo();
@@ -351,7 +351,7 @@ readln(void)
noecho();
curs_set(FALSE);
timeout(1000);
- return ln[0] ? strdup(ln) : NULL;
+ return ln[0] ? ln : NULL;
}
int
@@ -567,7 +567,7 @@ redraw(void)
}
void
-browse(const char *ipath, const char *ifilter)
+browse(char *ipath, char *ifilter)
{
char newpath[PATH_MAX];
char *name, *bin, *dir, *tmp, *run, *env;
@@ -661,13 +661,11 @@ nochange:
printprompt("filter: ");
tmp = readln();
if (tmp == NULL)
- tmp = xstrdup(ifilter);
+ tmp = ifilter;
/* Check and report regex errors */
r = setfilter(&re, tmp);
- if (r != 0) {
- free(tmp);
+ if (r != 0)
goto nochange;
- }
strlcpy(fltr, tmp, sizeof(fltr));
DPRINTF_S(fltr);
/* Save current */
@@ -705,7 +703,6 @@ nochange:
goto nochange;
}
mkpath(path, tmp, newpath, sizeof(newpath));
- free(tmp);
if (canopendir(newpath) == 0) {
printwarn();
goto nochange;
Un proyecto texto-plano.xyz