noice: update to 0.7.
This commit is contained in:
parent
ff79ffc2cc
commit
810c2796cd
2 changed files with 3 additions and 103 deletions
|
@ -1,100 +0,0 @@
|
|||
From 7136d6b548055cdb9ce9d9aa5f5f12c9d6e6ead5 Mon Sep 17 00:00:00 2001
|
||||
From: Nathan Owens <ndowens04@gmail.com>
|
||||
Date: Tue, 1 Jan 2019 06:46:10 -0600
|
||||
Subject: [PATCH] Fix regex memory leak
|
||||
|
||||
---
|
||||
noice.c | 33 ++++++++++++++++++++++++++++-----
|
||||
1 file changed, 28 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git noice.c noice.c
|
||||
index 2dc895d..8bc57de 100644
|
||||
--- noice.c
|
||||
+++ noice.c
|
||||
@@ -38,6 +38,7 @@
|
||||
#define MIN(x, y) ((x) < (y) ? (x) : (y))
|
||||
#define ISODD(x) ((x) & 1)
|
||||
#define CONTROL(c) ((c) ^ 0x40)
|
||||
+#define META(c) ((c) ^ 0x80)
|
||||
|
||||
struct assoc {
|
||||
char *regex; /* Regex to match on filename */
|
||||
@@ -213,8 +214,10 @@ openwith(char *file)
|
||||
continue;
|
||||
if (regexec(®ex, file, 0, NULL, 0) == 0) {
|
||||
bin = assocs[i].bin;
|
||||
+ regfree(®ex);
|
||||
break;
|
||||
}
|
||||
+ regfree(®ex);
|
||||
}
|
||||
DPRINTF_S(bin);
|
||||
return bin;
|
||||
@@ -238,6 +241,12 @@ setfilter(regex_t *regex, char *filter)
|
||||
return r;
|
||||
}
|
||||
|
||||
+void
|
||||
+freefilter(regex_t *regex)
|
||||
+{
|
||||
+ regfree(regex);
|
||||
+}
|
||||
+
|
||||
void
|
||||
initfilter(int dot, char **ifilter)
|
||||
{
|
||||
@@ -327,18 +336,28 @@ printprompt(char *str)
|
||||
printw(str);
|
||||
}
|
||||
|
||||
-/* Returns SEL_* if key is bound and 0 otherwise.
|
||||
- * Also modifies the run and env pointers (used on SEL_{RUN,RUNARG}) */
|
||||
-int
|
||||
-nextsel(char **run, char **env)
|
||||
+int xgetch(void)
|
||||
{
|
||||
- int c, i;
|
||||
+ int c;
|
||||
|
||||
c = getch();
|
||||
if (c == -1)
|
||||
idle++;
|
||||
else
|
||||
idle = 0;
|
||||
+ return c;
|
||||
+}
|
||||
+
|
||||
+/* Returns SEL_* if key is bound and 0 otherwise.
|
||||
+ * Also modifies the run and env pointers (used on SEL_{RUN,RUNARG}) */
|
||||
+int
|
||||
+nextsel(char **run, char **env)
|
||||
+{
|
||||
+ int c, i;
|
||||
+
|
||||
+ c = xgetch();
|
||||
+ if (c == 033)
|
||||
+ c = META(xgetch());
|
||||
|
||||
for (i = 0; i < LEN(bindings); i++)
|
||||
if (c == bindings[i].sym) {
|
||||
@@ -520,6 +539,9 @@ populate(char *path, char *oldpath, char *fltr)
|
||||
dents = NULL;
|
||||
|
||||
ndents = dentfill(path, &dents, visible, &re);
|
||||
+ freefilter(&re);
|
||||
+ if (ndents == 0)
|
||||
+ return 0; /* Empty result */
|
||||
|
||||
qsort(dents, ndents, sizeof(*dents), entrycmp);
|
||||
|
||||
@@ -677,6 +699,7 @@ nochange:
|
||||
r = setfilter(&re, tmp);
|
||||
if (r != 0)
|
||||
goto nochange;
|
||||
+ freefilter(&re);
|
||||
strlcpy(fltr, tmp, sizeof(fltr));
|
||||
DPRINTF_S(fltr);
|
||||
/* Save current */
|
||||
--
|
||||
2.20.1
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
# Template file for 'noice'
|
||||
pkgname=noice
|
||||
version=0.6
|
||||
revision=3
|
||||
version=0.7
|
||||
revision=1
|
||||
build_style=gnu-makefile
|
||||
make_install_args="MANPREFIX=/usr/share/man"
|
||||
makedepends="ncurses-devel"
|
||||
|
@ -10,7 +10,7 @@ maintainer="Juan RP <xtraeme@voidlinux.org>"
|
|||
license="BSD-2-Clause"
|
||||
homepage="http://git.2f30.org/noice"
|
||||
distfiles="http://dl.2f30.org/releases/${pkgname}-${version}.tar.gz"
|
||||
checksum=1996e71dd309f83bd2f892b996fa0c2c481949d2e3dd49e4f7649a1fce5ab351
|
||||
checksum=ecbe406a4ba412080522bb143e5789c51c2d54dceb5164c9bf8ea9ffec9f600d
|
||||
|
||||
post_install() {
|
||||
vlicense LICENSE
|
||||
|
|
Loading…
Reference in a new issue