[Pcre-svn] [98] code/trunk/src: Call _pcre2_jit_free from pc…

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [98] code/trunk/src: Call _pcre2_jit_free from pcre2_code_free.
Revision: 98
          http://www.exim.org/viewvc/pcre2?view=rev&revision=98
Author:   ph10
Date:     2014-10-07 14:07:20 +0100 (Tue, 07 Oct 2014)


Log Message:
-----------
Call _pcre2_jit_free from pcre2_code_free.

Modified Paths:
--------------
    code/trunk/src/pcre2_compile.c
    code/trunk/src/pcre2_internal.h
    code/trunk/src/pcre2_jit_misc.c


Modified: code/trunk/src/pcre2_compile.c
===================================================================
--- code/trunk/src/pcre2_compile.c    2014-10-06 17:28:42 UTC (rev 97)
+++ code/trunk/src/pcre2_compile.c    2014-10-07 13:07:20 UTC (rev 98)
@@ -668,8 +668,6 @@
 };



-/* FIXME: this is currently incomplete (free JIT?) */
-
 /*************************************************
 *               Free compiled code               *
 *************************************************/
@@ -677,7 +675,11 @@
 PCRE2_EXP_DEFN void PCRE2_CALL_CONVENTION
 pcre2_code_free(pcre2_code *code)
 {
-if (code != NULL) code->memctl.free(code, code->memctl.memory_data);
+if (code != NULL) 
+  {
+  if (code->executable_jit != NULL) PRIV(jit_free(code->executable_jit)); 
+  code->memctl.free(code, code->memctl.memory_data);
+  } 
 }




Modified: code/trunk/src/pcre2_internal.h
===================================================================
--- code/trunk/src/pcre2_internal.h    2014-10-06 17:28:42 UTC (rev 97)
+++ code/trunk/src/pcre2_internal.h    2014-10-07 13:07:20 UTC (rev 98)
@@ -1858,6 +1858,7 @@
 #define _pcre2_compile_context_init  PCRE2_SUFFIX(_pcre2_compile_context_init_)
 #define _pcre2_find_bracket          PCRE2_SUFFIX(_pcre2_find_bracket_)
 #define _pcre2_is_newline            PCRE2_SUFFIX(_pcre2_is_newline_)
+#define _pcre2_jit_free              PCRE2_SUFFIX(_pcre2_jit_free_)
 #define _pcre2_jit_get_size          PCRE2_SUFFIX(_pcre2_jit_get_size_)
 #define _pcre2_match_context_init    PCRE2_SUFFIX(_pcre2_match_context_init_)
 #define _pcre2_memctl_malloc         PCRE2_SUFFIX(_pcre2_memctl_malloc_)
@@ -1877,6 +1878,7 @@
 extern PCRE2_SPTR _pcre2_find_bracket(PCRE2_SPTR, BOOL, int);
 extern BOOL  _pcre2_is_newline(PCRE2_SPTR, uint32_t, PCRE2_SPTR, uint32_t *,
                BOOL);
+extern void  _pcre2_jit_free(void *);                
 extern size_t _pcre2_jit_get_size(void *);
 extern void  _pcre2_match_context_init(pcre2_match_context *, BOOL);
 extern void  *_pcre2_memctl_malloc(size_t, pcre2_memctl *);


Modified: code/trunk/src/pcre2_jit_misc.c
===================================================================
--- code/trunk/src/pcre2_jit_misc.c    2014-10-06 17:28:42 UTC (rev 97)
+++ code/trunk/src/pcre2_jit_misc.c    2014-10-07 13:07:20 UTC (rev 98)
@@ -44,14 +44,29 @@
 #endif



-/* FIXME: these are dummy functions */

+/*************************************************
+*           Free JIT compiled code               *
+*************************************************/


+void
+PRIV(jit_free)(void *executable_jit)
+{
+#ifndef SUPPORT_JIT
+(void)executable_jit;
+#else  /* SUPPORT_JIT */
+
+/* Dummy code */
+(void)executable_jit;
+
+#endif /* SUPPORT_JIT */
+}
+
+
 /*************************************************
 *            Free unused JIT memory              *
 *************************************************/


-
PCRE2_EXP_DEFN void PCRE2_CALL_CONVENTION
pcre2_jit_free_unused_memory(pcre2_general_context *gcontext)
{