return SP_OK;
}
+void sp_free_port(struct sp_port *port)
+{
+ if (!port)
+ return;
+
+ if (port->name)
+ free(port->name);
+
+ free(port);
+}
+
static struct sp_port **sp_list_append(struct sp_port **list, const char *portname)
{
void *tmp;
{
unsigned int i;
for (i = 0; list[i]; i++)
- free(list[i]);
+ sp_free_port(list[i]);
free(list);
}
};
int sp_get_port_by_name(const char *portname, struct sp_port **port_ptr);
+void sp_free_port(struct sp_port *port);
int sp_list_ports(struct sp_port ***list_ptr);
void sp_free_port_list(struct sp_port **ports);
int sp_open(struct sp_port *port, int flags);