From 2134212fa9a481efb1281189678c84950900b224 Mon Sep 17 00:00:00 2001
From: Benno Schulenberg <bensberg@justemail.net>
Date: Fri, 26 Feb 2016 17:25:48 +0000
Subject: [PATCH] Eliding the function nfreeregex(), now used just once.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5688 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 ChangeLog   |  1 +
 src/color.c | 17 +++++------------
 2 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 73280676..045f8725 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,7 @@
 	* src/color.c (color_update): Strip things bare to see the sameness.
 	* src/color.c (found_in_list): Factor out this triple repetition.
 	* src/color.c (color_update): Rename a variable for conciseness.
+	* src/color.c (nfreeregex): Elide this function, now used just once.
 
 GNU nano 2.5.3 - 2016.02.25
 
diff --git a/src/color.c b/src/color.c
index 0905617d..542ed76c 100644
--- a/src/color.c
+++ b/src/color.c
@@ -139,16 +139,6 @@ void color_init(void)
     }
 }
 
-/* Clean up a regex we previously compiled. */
-void nfreeregex(regex_t **r)
-{
-    assert(r != NULL);
-
-    regfree(*r);
-    free(*r);
-    *r = NULL;
-}
-
 /* Try to match the given shibboleth string with one of the regexes in
  * the list starting at head.  Return TRUE upon success. */
 bool found_in_list(regexlisttype *head, const char *shibboleth)
@@ -167,8 +157,11 @@ bool found_in_list(regexlisttype *head, const char *shibboleth)
 	if (regexec(item->ext, shibboleth, 0, NULL, 0) == 0)
 	    return TRUE;
 
-	if (not_compiled)
-	    nfreeregex(&item->ext);
+	if (not_compiled) {
+	    regfree(item->ext);
+	    free(item->ext);
+	    item->ext = NULL;
+	}
     }
 
     return FALSE;
-- 
GitLab