From: Martin Ling Date: Mon, 18 Nov 2013 22:07:09 +0000 (+0000) Subject: Mark config argument to sp_set_config as const. X-Git-Tag: libserialport-0.1.0~105 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=bf2cbd652f9b520dcd3de9c98f000b85de00dba6;p=libserialport.git Mark config argument to sp_set_config as const. --- diff --git a/libserialport.h.in b/libserialport.h.in index 4d94a41..2f33905 100644 --- a/libserialport.h.in +++ b/libserialport.h.in @@ -157,7 +157,7 @@ int sp_flush(struct sp_port *port); /* Basic port configuration */ int sp_get_config(struct sp_port *port, struct sp_port_config *config); -int sp_set_config(struct sp_port *port, struct sp_port_config *config); +int sp_set_config(struct sp_port *port, const struct sp_port_config *config); int sp_set_baudrate(struct sp_port *port, int baudrate); int sp_set_bits(struct sp_port *port, int bits); int sp_set_parity(struct sp_port *port, int parity); diff --git a/serialport.c b/serialport.c index 065a224..7066091 100644 --- a/serialport.c +++ b/serialport.c @@ -95,7 +95,7 @@ const struct std_baudrate std_baudrates[] = { static int validate_port(struct sp_port *port); static struct sp_port **list_append(struct sp_port **list, const char *portname); static int get_config(struct sp_port *port, struct port_data *data, struct sp_port_config *config); -static int set_config(struct sp_port *port, struct port_data *data, struct sp_port_config *config); +static int set_config(struct sp_port *port, struct port_data *data, const struct sp_port_config *config); int sp_get_port_by_name(const char *portname, struct sp_port **port_ptr) { @@ -726,7 +726,7 @@ static int get_config(struct sp_port *port, struct port_data *data, struct sp_po return SP_OK; } -static int set_config(struct sp_port *port, struct port_data *data, struct sp_port_config *config) +static int set_config(struct sp_port *port, struct port_data *data, const struct sp_port_config *config) { unsigned int i; @@ -1005,7 +1005,7 @@ static int set_config(struct sp_port *port, struct port_data *data, struct sp_po #define TRY(x) do { int ret = x; if (ret != SP_OK) return ret; } while (0) -int sp_set_config(struct sp_port *port, struct sp_port_config *config) +int sp_set_config(struct sp_port *port, const struct sp_port_config *config) { struct port_data data; struct sp_port_config prev_config;