Logo Search packages:      
Sourcecode: libgphoto2 version File versions  Download package

int gp_port_free ( GPPort port  ) 

Free the port structure.

port a GPPort
Closes the port and frees the memory.

a gphoto2 error code

Definition at line 297 of file gphoto2-port.c.

References CHECK_NULL, gp_log(), GP_LOG_DEBUG, GP_OK, gp_port_close(), _GPPortPrivateCore::lh, _GPPortPrivateCore::ops, and _GPPort::pc.

Referenced by gp_abilities_list_detect(), gp_camera_free(), and gp_port_new().

      gp_log (GP_LOG_DEBUG, "gphoto2-port", _("Freeing port..."));

      CHECK_NULL (port);

      if (port->pc) {
            if (port->pc->ops) {

                  /* We don't care for return values */
                  gp_port_close (port);
                  gp_port_exit (port);

                  free (port->pc->ops);
                  port->pc->ops = NULL;

            if (port->pc->lh) {
                  lt_dlclose (port->pc->lh);
                  lt_dlexit ();
                  port->pc->lh = NULL;

            free (port->pc);
            port->pc = NULL;

        free (port);

        return GP_OK;

Generated by  Doxygen 1.6.0   Back to index