aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--backends/artnet.c12
-rw-r--r--backends/sacn.c10
2 files changed, 4 insertions, 18 deletions
diff --git a/backends/artnet.c b/backends/artnet.c
index 57eb7b1..e01f038 100644
--- a/backends/artnet.c
+++ b/backends/artnet.c
@@ -77,16 +77,12 @@ static int artnet_configure(char* option, char* value){
else if(!strcmp(option, "bind")){
mmbackend_parse_hostspec(value, &host, &port);
- if(!port){
- port = ARTNET_PORT;
- }
-
if(!host){
fprintf(stderr, "Not valid ArtNet bind address given\n");
return 1;
}
- if(artnet_listener(host, port)){
+ if(artnet_listener(host, (port ? port : ARTNET_PORT))){
fprintf(stderr, "Failed to bind ArtNet descriptor: %s\n", value);
return 1;
}
@@ -140,16 +136,12 @@ static int artnet_configure_instance(instance* inst, char* option, char* value){
else if(!strcmp(option, "dest") || !strcmp(option, "destination")){
mmbackend_parse_hostspec(value, &host, &port);
- if(!port){
- port = ARTNET_PORT;
- }
-
if(!host){
fprintf(stderr, "Not a valid ArtNet destination for instance %s\n", inst->name);
return 1;
}
- return mmbackend_parse_sockaddr(host, port, &data->dest_addr, &data->dest_len);
+ return mmbackend_parse_sockaddr(host, port ? port : ARTNET_PORT, &data->dest_addr, &data->dest_len);
}
fprintf(stderr, "Unknown ArtNet option %s for instance %s\n", option, inst->name);
diff --git a/backends/sacn.c b/backends/sacn.c
index 2229b8a..edb648d 100644
--- a/backends/sacn.c
+++ b/backends/sacn.c
@@ -111,16 +111,13 @@ static int sacn_configure(char* option, char* value){
}
else if(!strcmp(option, "bind")){
mmbackend_parse_hostspec(value, &host, &port);
- if(!port){
- port = SACN_PORT;
- }
if(!host){
fprintf(stderr, "No valid sACN bind address provided\n");
return 1;
}
- if(sacn_listener(host, port, flags)){
+ if(sacn_listener(host, port ? port : SACN_PORT, flags)){
fprintf(stderr, "Failed to bind sACN descriptor: %s\n", value);
return 1;
}
@@ -155,16 +152,13 @@ static int sacn_configure_instance(instance* inst, char* option, char* value){
}
else if(!strcmp(option, "destination")){
mmbackend_parse_hostspec(value, &host, &port);
- if(!port){
- port = SACN_PORT;
- }
if(!host){
fprintf(stderr, "No valid sACN destination for instance %s\n", inst->name);
return 1;
}
- return mmbackend_parse_sockaddr(host, port, &data->dest_addr, &data->dest_len);
+ return mmbackend_parse_sockaddr(host, port ? port : SACN_PORT, &data->dest_addr, &data->dest_len);
}
else if(!strcmp(option, "from")){
next = value;