pspp-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pspp-cvs] Changes to pspp/src/file-handle.q


From: John Darrington
Subject: [Pspp-cvs] Changes to pspp/src/file-handle.q
Date: Fri, 21 Jan 2005 06:59:44 -0500

Index: pspp/src/file-handle.q
diff -u pspp/src/file-handle.q:1.11 pspp/src/file-handle.q:1.12
--- pspp/src/file-handle.q:1.11 Mon Nov 15 09:51:22 2004
+++ pspp/src/file-handle.q      Fri Jan 21 11:59:39 2005
@@ -30,6 +30,8 @@
 #include "error.h"
 #include "magic.h"
 #include "var.h"
+#include "linked-list.h"
+
 /* (headers) */
 
 /* File handle. */
@@ -215,6 +217,15 @@
   return handle;
 }
 
+void
+destroy_file_handle(struct file_handle *fh, void *aux UNUSED)
+{
+  free (fh->name);
+  free (fh->filename);
+  fn_free_identity (fh->identity);
+  free (fh);
+}
+
 static const char *
 mode_name (const char *mode) 
 {
@@ -304,6 +315,10 @@
   return h->open_cnt;
 }
 
+
+static struct linked_list *handle_list;
+
+
 /* Parses a file handle name, which may be a filename as a string or
    a file handle name as an identifier.  Returns the file handle or
    NULL on failure. */
@@ -330,11 +345,13 @@
       char *handle_name = xmalloc (strlen (filename) + 3);
       sprintf (handle_name, "\"%s\"", filename);
       handle = create_file_handle (handle_name, filename);
+      ll_push_front(handle_list, handle);
       free (handle_name);
     }
 
   lex_get ();
 
+
   return handle;
 }
 
@@ -386,6 +403,23 @@
   return handle->tab_width;
 }
 
+
+void 
+fh_init(void)
+{
+  handle_list = ll_create(destroy_file_handle,0);
+}
+
+void 
+fh_done(void)
+{
+  assert(handle_list);
+  
+  ll_destroy(handle_list);
+  handle_list = 0;
+}
+
+
 /*
    Local variables:
    mode: c




reply via email to

[Prev in Thread] Current Thread [Next in Thread]