diff options
| author | David Lamparter <equinox@diac24.net> | 2016-11-13 12:19:14 +0900 |
|---|---|---|
| committer | David Lamparter <equinox@opensourcerouting.org> | 2017-03-08 00:15:39 +0100 |
| commit | 4525281af19b5800ffce4bda83e0957d21ccad43 (patch) | |
| tree | 8919c479f14116f3cae9fc5b051673e2f796371d /lib/sockunion.c | |
| parent | 16077f2fc5f4d73648b4ebef877e1f021864358d (diff) | |
*: get rid of zlog(*, LOG_LEVEL, ...)
Result of running the following Coccinelle patch + fixups:
<<EOF
/* long-forms: zlog(NULL, <level>, ...)
* => zlog_level(...)
*/
@@
expression list args;
@@
- zlog(NULL, LOG_DEBUG, args)
+ zlog_debug(args)
@@
expression list args;
@@
- zlog(NULL, LOG_NOTICE, args)
+ zlog_notice(args)
@@
expression list args;
@@
- zlog(NULL, LOG_INFO, args)
+ zlog_info(args)
@@
expression list args;
@@
- zlog(NULL, LOG_WARNING, args)
+ zlog_warn(args)
@@
expression list args;
@@
- zlog(NULL, LOG_ERR, args)
+ zlog_err(args)
/* long-forms: zlog(base->log, <level>, ...)
* => zlog_level(...)
*/
@@
expression base;
expression list args;
@@
- zlog(base->log, LOG_DEBUG, args)
+ zlog_debug(args)
@@
expression base;
expression list args;
@@
- zlog(base->log, LOG_NOTICE, args)
+ zlog_notice(args)
@@
expression base;
expression list args;
@@
- zlog(base->log, LOG_INFO, args)
+ zlog_info(args)
@@
expression base;
expression list args;
@@
- zlog(base->log, LOG_WARNING, args)
+ zlog_warn(args)
@@
expression base;
expression list args;
@@
- zlog(base->log, LOG_ERR, args)
+ zlog_err(args)
EOF
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
Diffstat (limited to 'lib/sockunion.c')
| -rw-r--r-- | lib/sockunion.c | 37 |
1 files changed, 17 insertions, 20 deletions
diff --git a/lib/sockunion.c b/lib/sockunion.c index 5b508d1bf8..9ba2ce82f6 100644 --- a/lib/sockunion.c +++ b/lib/sockunion.c @@ -148,8 +148,8 @@ sockunion_socket (const union sockunion *su) if (sock < 0) { char buf[SU_ADDRSTRLEN]; - zlog (NULL, LOG_WARNING, "Can't make socket for %s : %s", - sockunion_log (su, buf, SU_ADDRSTRLEN), safe_strerror (errno)); + zlog_warn("Can't make socket for %s : %s", + sockunion_log(su, buf, SU_ADDRSTRLEN), safe_strerror(errno)); return -1; } @@ -264,7 +264,7 @@ sockunion_stream_socket (union sockunion *su) sock = socket (su->sa.sa_family, SOCK_STREAM, 0); if (sock < 0) - zlog (NULL, LOG_WARNING, "can't make socket sockunion_stream_socket"); + zlog_warn("can't make socket sockunion_stream_socket"); return sock; } @@ -308,8 +308,8 @@ sockunion_bind (int sock, union sockunion *su, unsigned short port, if (ret < 0) { char buf[SU_ADDRSTRLEN]; - zlog (NULL, LOG_WARNING, "can't bind socket for %s : %s", - sockunion_log (su, buf, SU_ADDRSTRLEN), safe_strerror (errno)); + zlog_warn("can't bind socket for %s : %s", + sockunion_log(su, buf, SU_ADDRSTRLEN), safe_strerror(errno)); } return ret; @@ -325,7 +325,7 @@ sockopt_reuseaddr (int sock) (void *) &on, sizeof (on)); if (ret < 0) { - zlog (NULL, LOG_WARNING, "can't set sockopt SO_REUSEADDR to socket %d", sock); + zlog_warn("can't set sockopt SO_REUSEADDR to socket %d", sock); return -1; } return 0; @@ -342,7 +342,7 @@ sockopt_reuseport (int sock) (void *) &on, sizeof (on)); if (ret < 0) { - zlog (NULL, LOG_WARNING, "can't set sockopt SO_REUSEPORT to socket %d", sock); + zlog_warn("can't set sockopt SO_REUSEPORT to socket %d", sock); return -1; } return 0; @@ -367,7 +367,7 @@ sockopt_ttl (int family, int sock, int ttl) (void *) &ttl, sizeof (int)); if (ret < 0) { - zlog (NULL, LOG_WARNING, "can't set sockopt IP_TTL %d to socket %d", ttl, sock); + zlog_warn("can't set sockopt IP_TTL %d to socket %d", ttl, sock); return -1; } return 0; @@ -379,8 +379,8 @@ sockopt_ttl (int family, int sock, int ttl) (void *) &ttl, sizeof (int)); if (ret < 0) { - zlog (NULL, LOG_WARNING, "can't set sockopt IPV6_UNICAST_HOPS %d to socket %d", - ttl, sock); + zlog_warn("can't set sockopt IPV6_UNICAST_HOPS %d to socket %d", + ttl, sock); return -1; } return 0; @@ -425,9 +425,8 @@ sockopt_minttl (int family, int sock, int minttl) { int ret = setsockopt (sock, IPPROTO_IP, IP_MINTTL, &minttl, sizeof(minttl)); if (ret < 0) - zlog (NULL, LOG_WARNING, - "can't set sockopt IP_MINTTL to %d on socket %d: %s", - minttl, sock, safe_strerror (errno)); + zlog_warn("can't set sockopt IP_MINTTL to %d on socket %d: %s", + minttl, sock, safe_strerror(errno)); return ret; } #endif /* IP_MINTTL */ @@ -436,9 +435,8 @@ sockopt_minttl (int family, int sock, int minttl) { int ret = setsockopt (sock, IPPROTO_IPV6, IPV6_MINHOPCOUNT, &minttl, sizeof(minttl)); if (ret < 0) - zlog (NULL, LOG_WARNING, - "can't set sockopt IPV6_MINHOPCOUNT to %d on socket %d: %s", - minttl, sock, safe_strerror (errno)); + zlog_warn("can't set sockopt IPV6_MINHOPCOUNT to %d on socket %d: %s", + minttl, sock, safe_strerror(errno)); return ret; } #endif @@ -459,8 +457,8 @@ sockopt_v6only (int family, int sock) (void *) &on, sizeof (int)); if (ret < 0) { - zlog (NULL, LOG_WARNING, "can't set sockopt IPV6_V6ONLY " - "to socket %d", sock); + zlog_warn("can't set sockopt IPV6_V6ONLY " "to socket %d", + sock); return -1; } return 0; @@ -626,8 +624,7 @@ sockunion_getpeername (int fd) ret = getpeername (fd, (struct sockaddr *)&name, &len); if (ret < 0) { - zlog (NULL, LOG_WARNING, "Can't get remote address and port: %s", - safe_strerror (errno)); + zlog_warn("Can't get remote address and port: %s", safe_strerror(errno)); return NULL; } |
