+John Darrington <john@darrington.wattle.id.au>
+
+ * settings.h set.c glob.[ch] frequencies.q q2c.c error.c lexer.[ch]
+ output.[ch] getline.c
+
+ Plugged some memory leaks
+
Mon Nov 15 23:47:40 2004 Ben Pfaff <blp@gnu.org>
Adopt GSL random number generators, paving the way for providing
static int postopen (struct file_ext *);
static int preclose (struct file_ext *);
+static struct outp_option_info *option_info;
+
static int
ascii_open_global (struct outp_class *this UNUSED)
{
+ option_info = xmalloc ( sizeof (struct outp_option_info ) ) ;
+ option_info->initial = 0;
+ option_info->options = 0;
return 1;
}
+static unsigned char *s=0;
static int
ascii_close_global (struct outp_class *this UNUSED)
{
+ free(option_info->initial);
+ free(option_info->options);
+ free(option_info);
+ free(s);
return 1;
}
{"squeeze", boolean_arg, 2},
{"", 0, 0},
};
-static struct outp_option_info option_info;
static void
ascii_option (struct outp_driver *this, const char *key,
return;
}
- cat = outp_match_keyword (key, option_tab, &option_info, &subcat);
+ cat = outp_match_keyword (key, option_tab, option_info, &subcat);
switch (cat)
{
case 0:
}
}
+
static int
ascii_close_page (struct outp_driver *this)
{
- static unsigned char *s;
static int s_len;
struct ascii_driver_ext *x = this->ext;
memcpy (cp, ls_c_str (&x->ops[OPS_FORMFEED]), ff_len);
if ( x->paginate )
output_string (this, s, &s[total_len]);
+
if (line_p != line_buf && !commit_line_buf (this))
+ {
+ free(s);
+ s=0;
return 0;
+ }
this->page_open = 0;
return 1;
{
terminating = 1;
+ lex_done();
getl_uninitialize ();
+ free(file_loc);
outp_done ();
+ done_glob();
+
exit (success ? EXIT_SUCCESS : EXIT_FAILURE);
}
/* Do it! */
procedure_with_splits (precalc, calc, postcalc, NULL);
+ free_frequencies(&cmd);
+
return CMD_SUCCESS;
}
if (history_file)
write_history (history_file);
#endif
+ ds_destroy (&getl_buf);
+ ds_destroy (&getl_include_path);
}
/* Returns a string that represents the directory that the syntax file
get_date ();
}
+void
+done_glob(void)
+{
+ dict_destroy(default_dict);
+ free(logfn);
+ done_settings();
+ ds_destroy (&tokstr);
+}
+
static void
get_date (void)
{
#define INCLUDED_GLOB_H 1
void init_glob (int argc UNUSED, char **argv);
+void done_glob (void);
#endif /* glob.h */
if (!lex_get_line ())
unexpected_eof ();
}
+
+void
+lex_done (void)
+{
+ ds_destroy(&put_tokstr);
+}
+
\f
/* Common functions. */
/* Initialization. */
void lex_init (void);
+void lex_done (void);
/* Common functions. */
void lex_get (void);
int
outp_done (void)
{
+ struct outp_driver_class_list *n = outp_class_list ;
#if GLOBAL_DEBUGGING
if (iterating_driver_list)
reentrancy ();
#endif
destroy_list (&outp_driver_list);
+ while (n)
+ {
+ struct outp_driver_class_list *next = n->next;
+ free(n);
+ n = next;
+ }
+
return 1;
}
struct outp_driver_class_list *next;
};
-/* List of known output driver classes. */
-extern struct outp_driver_class_list *outp_class_list;
-
/* List of configured output drivers. */
extern struct outp_driver *outp_driver_list;
dump (0, "free (p->s_%s);", st_lower (sbc->name));
break;
case SBC_DBL_LIST:
- dump (0, "subc_list_double_destroy(p->dl_%s);", st_lower (sbc->name));
+ dump (0, "int i;");
+ dump (1, "for(i = 0; i < MAXLISTS ; ++i)");
+ dump (0, "subc_list_double_destroy(&p->dl_%s[i]);", st_lower (sbc->name));
+ outdent();
break;
default:
break;
int get_viewwidth(void);
void init_settings(void) ;
+void done_settings(void) ;
/* Whether pspp can erase and overwrite files */
int safer_mode(void);