Added custom assert(); Fixed bugs in T-TEST and VALUE LABELS
[pspp-builds.git] / src / vfm.c
index 4a693bc297f2b05a788cc2252b3111b5917def19..1ea4211e32c521065c6ab866ec2d92eb14e4bdd3 100644 (file)
--- a/src/vfm.c
+++ b/src/vfm.c
@@ -20,7 +20,7 @@
 #include <config.h>
 #include "vfm.h"
 #include "vfmP.h"
-#include <assert.h>
+#include "error.h"
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -435,8 +435,12 @@ close_active_file (void)
   /* Old data sink becomes new data source. */
   if (vfm_sink->class->make_source != NULL)
     vfm_source = vfm_sink->class->make_source (vfm_sink);
-  else
-    vfm_source = NULL;
+  else 
+    {
+      if (vfm_sink->class->destroy != NULL)
+        vfm_sink->class->destroy (vfm_sink);
+      vfm_source = NULL; 
+    }
   free_case_sink (vfm_sink);
   vfm_sink = NULL;
 
@@ -492,7 +496,7 @@ storage_sink_open (struct case_sink *sink)
   else 
     {
       info->mode = MEMORY; 
-      info->max_cases = (set_max_workspace
+      info->max_cases = (get_max_workspace()
                          / (sizeof (struct case_list) + info->case_size));
     }
 }
@@ -598,7 +602,7 @@ storage_sink_write (struct case_sink *sink, const struct ccase *c)
           workspace_overflow = 1;
           msg (MW, _("Workspace limit of %d KB (%d cases at %d bytes each) "
                      "overflowed.  Writing active file to disk."),
-               set_max_workspace / 1024, info->max_cases,
+               get_max_workspace() / 1024, info->max_cases,
                sizeof (struct case_list) + info->case_size);
 
           storage_to_disk (info, sink->value_cnt);