summaryrefslogtreecommitdiff
path: root/src/resolve/resolved-dns-packet.h
diff options
context:
space:
mode:
authorDaniel Mack <daniel@zonque.org>2015-07-11 16:21:26 -0400
committerDaniel Mack <daniel@zonque.org>2015-08-25 14:25:56 +0200
commit106784ebb7b303ae471851100a773ad2aebf5b80 (patch)
treee486bff2f465631ecd21bbc491dc79b1072b8dc5 /src/resolve/resolved-dns-packet.h
parent8326c7f789bad623a5705b04b78d104d993a90ee (diff)
resolved: use switch-case statements for protocol details
With more protocols to come, switch repetitive if-else blocks with a switch-case statements.
Diffstat (limited to 'src/resolve/resolved-dns-packet.h')
-rw-r--r--src/resolve/resolved-dns-packet.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/resolve/resolved-dns-packet.h b/src/resolve/resolved-dns-packet.h
index e81f8a8202..8a72b898da 100644
--- a/src/resolve/resolved-dns-packet.h
+++ b/src/resolve/resolved-dns-packet.h
@@ -239,11 +239,16 @@ static inline uint64_t SD_RESOLVED_FLAGS_MAKE(DnsProtocol protocol, int family)
/* Converts a protocol + family into a flags field as used in queries */
- if (protocol == DNS_PROTOCOL_DNS)
+ switch (protocol) {
+ case DNS_PROTOCOL_DNS:
return SD_RESOLVED_DNS;
- if (protocol == DNS_PROTOCOL_LLMNR)
+ case DNS_PROTOCOL_LLMNR:
return family == AF_INET6 ? SD_RESOLVED_LLMNR_IPV6 : SD_RESOLVED_LLMNR_IPV4;
+ default:
+ break;
+ }
+
return 0;
}