output: Make allocating and freeing drivers independent of configuration.
[pspp-builds.git] / src / output / cairo.c
index 048ac7e9cd057a5600cb5186770edbaf11a0792d..53c454c2daeaa0bfe04e9821b58fb08d7b3749ac 100644 (file)
@@ -135,14 +135,16 @@ static int text_width (struct outp_driver *, const char *, enum outp_font);
 /* Driver initialization. */
 
 static bool
-xr_open_driver (struct outp_driver *this, struct substring options)
+xr_open_driver (const char *name, int types, struct substring options)
 {
   cairo_surface_t *surface;
   cairo_status_t status;
+  struct outp_driver *this;
   struct xr_driver_ext *x;
   double width_pt, length_pt;
   size_t i;
 
+  this = outp_allocate_driver (&cairo_class, name, types);
   this->width = this->length = 0;
   this->font_height = XR_POINT * 10;
 
@@ -240,10 +242,12 @@ xr_open_driver (struct outp_driver *this, struct substring options)
   memcpy (this->vert_line_width, this->horiz_line_width,
           sizeof this->vert_line_width);
 
+  outp_register_driver (this);
   return true;
 
  error:
   this->class->close_driver (this);
+  outp_free_driver (this);
   return false;
 }