Plugged some small memory leaks
[pspp] / src / output / output.c
index c9545761761efc15a5dc705212915e4066946491..91df8f022eb84cef6033963079dcadad3d326d3f 100644 (file)
@@ -70,12 +70,12 @@ static struct outp_names *outp_configure_vec;
 /* A list of driver classes. */
 struct outp_driver_class_list
   {
-    struct outp_class *class;
+    const struct outp_class *class;
     struct outp_driver_class_list *next;
   };
 
-struct outp_driver_class_list *outp_class_list;
-struct outp_driver *outp_driver_list;
+static struct outp_driver_class_list *outp_class_list;
+static struct outp_driver *outp_driver_list;
 
 char *outp_title;
 char *outp_subtitle;
@@ -91,7 +91,7 @@ static void configure_driver (const struct substring, const struct substring,
 
 /* Add a class to the class list. */
 static void
-add_class (struct outp_class *class)
+add_class (const struct outp_class *class)
 {
   struct outp_driver_class_list *new_list = xmalloc (sizeof *new_list);
 
@@ -227,7 +227,6 @@ outp_init (void)
 {
   extern struct outp_class ascii_class;
   extern struct outp_class postscript_class;
-  extern struct outp_class html_class;
 
   char def[] = "default";
 
@@ -797,7 +796,7 @@ destroy_driver (struct outp_driver *d)
    code and stores subcategory in *SUBCAT on success.  Returns -1
    on failure. */
 int
-outp_match_keyword (const char *s, struct outp_option *tab, int *subcat)
+outp_match_keyword (const char *s, const struct outp_option *tab, int *subcat)
 {
   for (; tab->keyword != NULL; tab++)
     if (!strcmp (s, tab->keyword))
@@ -927,9 +926,9 @@ lossage:
 
 /* Stores the dimensions in 1/72000" units of paper identified by
    SIZE, which is of form `HORZ x VERT' or `HORZ by VERT' where each
-   of HORZ and VERT are dimensions, into *H and *V.  Return nonzero on
+   of HORZ and VERT are dimensions, into *H and *V.  Return true on
    success. */
-static int
+static bool
 internal_get_paper_size (char *size, int *h, int *v)
 {
   char *tail;
@@ -938,7 +937,7 @@ internal_get_paper_size (char *size, int *h, int *v)
     size++;
   *h = outp_evaluate_dimension (size, &tail);
   if (tail == NULL)
-    return 0;
+    return false;
   while (isspace ((unsigned char) *tail))
     tail++;
   if (*tail == 'x')
@@ -948,7 +947,7 @@ internal_get_paper_size (char *size, int *h, int *v)
   else
     {
       error (0, 0, _("`x' expected in paper size `%s'"), size);
-      return 0;
+      return false;
     }
   *v = outp_evaluate_dimension (tail, &tail);
   if (tail == NULL)
@@ -958,19 +957,19 @@ internal_get_paper_size (char *size, int *h, int *v)
   if (*tail)
     {
       error (0, 0, _("trailing garbage `%s' on paper size `%s'"), tail, size);
-      return 0;
+      return false;
     }
   
-  return 1;
+  return true;
 }
 
 /* Stores the dimensions, in 1/72000" units, of paper identified by
    SIZE into *H and *V.  SIZE may be a pair of dimensions of form `H x
    V', or it may be a case-insensitive paper identifier, which is
-   looked up in the `papersize' configuration file.  Returns nonzero
+   looked up in the `papersize' configuration file.  Returns true
    on success.  May modify SIZE. */
 /* Don't read further unless you've got a strong stomach. */
-int
+bool
 outp_get_paper_size (char *size, int *h, int *v)
 {
   struct paper_size
@@ -987,7 +986,7 @@ outp_get_paper_size (char *size, int *h, int *v)
   int line_number = 0;
 
   bool free_it = false;
-  int result = 0;
+  bool result = false;
   char *ep;
 
   while (isspace ((unsigned char) *size))