summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2014-08-18 22:44:57 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2014-08-18 22:44:57 +0200
commitc9c7cbb67c8a3cff9241bee1e1b1902be4e0a799 (patch)
treed2c40a735217fc6fdc511578916d019066f2c4b9 /src
parentd39193123e57fe38532f8c3ab3029acf1e45ae92 (diff)
downloadfastd-c9c7cbb67c8a3cff9241bee1e1b1902be4e0a799.tar
fastd-c9c7cbb67c8a3cff9241bee1e1b1902be4e0a799.zip
Remove a few now unneeded peer->config NULL checks
Diffstat (limited to 'src')
-rw-r--r--src/log.c2
-rw-r--r--src/peer.c2
-rw-r--r--src/peer.h7
3 files changed, 4 insertions, 7 deletions
diff --git a/src/log.c b/src/log.c
index 8513c79..122b322 100644
--- a/src/log.c
+++ b/src/log.c
@@ -93,7 +93,7 @@ static size_t snprint_peer_address(char *buffer, size_t size, const fastd_peer_a
/** Creates a string representation of a peer */
static size_t snprint_peer_str(char *buffer, size_t size, const fastd_peer_t *peer) {
- if (peer->config && peer->config->name) {
+ if (peer->config->name) {
return snprintf_safe(buffer, size, "<%s>", peer->config->name);
}
else {
diff --git a/src/peer.c b/src/peer.c
index f621010..9c3186e 100644
--- a/src/peer.c
+++ b/src/peer.c
@@ -42,7 +42,7 @@ void fastd_peer_set_shell_env(fastd_shell_env_t *env, const fastd_peer_t *peer,
/* both INET6_ADDRSTRLEN and IFNAMESIZE already include space for the zero termination, so there is no need to add space for the '%' here. */
char buf[INET6_ADDRSTRLEN+IF_NAMESIZE];
- fastd_shell_env_set(env, "PEER_NAME", (peer && peer->config) ? peer->config->name : NULL);
+ fastd_shell_env_set(env, "PEER_NAME", peer ? peer->config->name : NULL);
switch(local_addr ? local_addr->sa.sa_family : AF_UNSPEC) {
case AF_INET:
diff --git a/src/peer.h b/src/peer.h
index 75c7b6b..9638808 100644
--- a/src/peer.h
+++ b/src/peer.h
@@ -225,7 +225,7 @@ static inline bool fastd_peer_config_is_floating(const fastd_peer_config_t *conf
/** Checks if a peer is floating (is has at least one floating remote or no remotes at all) */
static inline bool fastd_peer_is_floating(const fastd_peer_t *peer) {
- return peer->config ? fastd_peer_config_is_floating(peer->config) : true;
+ return fastd_peer_config_is_floating(peer->config);
}
/** Checks if a peer is not statically configured, but added after a on-verify run */
@@ -258,10 +258,7 @@ static inline bool fastd_peer_is_established(const fastd_peer_t *peer) {
/** Returns the peer's peer group */
static inline const fastd_peer_group_t * fastd_peer_get_group(const fastd_peer_t *peer) {
- if (peer->config)
- return peer->config->group;
- else
- return conf.peer_group;
+ return peer->config->group;
}
/** Signals that a valid packet was received from the peer */