File: memalloc.c-01.v6.23-test.diff

package info (click to toggle)
python-clips 1.0.7.348%2Bclips-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,376 kB
  • ctags: 2,544
  • sloc: ansic: 17,065; python: 5,668; sh: 20; makefile: 12
file content (33 lines) | stat: -rw-r--r-- 972 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
--- ../clipssrc_orig/memalloc.c	Wed Feb  2 10:53:30 2005
+++ ../clipssrc/memalloc.c	Sun May 28 20:09:14 2006
@@ -46,6 +46,21 @@
 
 #define STRICT_ALIGN_SIZE sizeof(double)
 
+
+/* use Python memory allocator when compiling PyCLIPS */
+#ifdef PYCLIPS
+#include <Python.h>
+void *PyCLIPS_Malloc(size_t s);
+void PyCLIPS_Free(void *p);
+#if !BLOCK_MEMORY
+   #undef malloc
+   #define malloc PyCLIPS_Malloc
+   #undef free
+   #define free PyCLIPS_Free
+#endif /* BLOCK_MEMORY */
+#endif /* PYCLIPS */
+
+
 #define SpecialMalloc(sz) malloc((STD_SIZE) sz)
 #define SpecialFree(ptr) free(ptr)
 
@@ -448,7 +463,7 @@
            { YieldTime(theEnv); }
         }
       MemoryData(theEnv)->MemoryTable[i] = NULL;
-      if (((amount > maximum) && (maximum > 0)) || EvaluationData(theEnv)->HaltExecution)
+      if ((amount > maximum) && (maximum > 0))
         {
          if (printMessage == TRUE)
            { EnvPrintRouter(theEnv,WDIALOG,"*** MEMORY  DEALLOCATED ***\n"); }