X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=serialport.c;h=272bdf6013a525b96a30cd869ea3e99ca0ea0499;hb=ad036cc8efcdcae5d2b8727996108c38c4915d2b;hp=1ace0ae32f9a5e97038573770ee8be30dc10f094;hpb=948f63f0fd0530c8653aa801f7e3d8a2cf2b12b2;p=libserialport.git diff --git a/serialport.c b/serialport.c index 1ace0ae..272bdf6 100644 --- a/serialport.c +++ b/serialport.c @@ -136,7 +136,7 @@ SP_API char *sp_get_port_description(struct sp_port *port) RETURN_STRING(port->description); } -SP_API enum sp_transport sp_get_port_transport(struct sp_port *port) +SP_API enum sp_transport sp_get_port_transport(const struct sp_port *port) { TRACE("%p", port); @@ -322,8 +322,10 @@ fail: SP_API enum sp_return sp_list_ports(struct sp_port ***list_ptr) { +#ifndef NO_ENUMERATION struct sp_port **list; int ret; +#endif TRACE("%p", list_ptr); @@ -1165,13 +1167,12 @@ static enum sp_return add_handle(struct sp_event_set *event_set, sizeof(event_handle) * (event_set->count + 1)))) RETURN_ERROR(SP_ERR_MEM, "Handle array realloc() failed"); + event_set->handles = new_handles; + if (!(new_masks = realloc(event_set->masks, - sizeof(enum sp_event) * (event_set->count + 1)))) { - free(new_handles); + sizeof(enum sp_event) * (event_set->count + 1)))) RETURN_ERROR(SP_ERR_MEM, "Mask array realloc() failed"); - } - event_set->handles = new_handles; event_set->masks = new_masks; ((event_handle *) event_set->handles)[event_set->count] = handle;