From 4c8230d2ce6a96bd1e02c9e4c36dc0f2e934066e Mon Sep 17 00:00:00 2001 From: Wouter Wijngaards Date: Tue, 23 Feb 2016 13:21:13 +0000 Subject: [PATCH] Prettier code. git-svn-id: file:///svn/unbound/trunk@3636 be551aaa-1e26-0410-a405-d3ace91eadb9 --- libunbound/libunbound.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/libunbound/libunbound.c b/libunbound/libunbound.c index d62e41ce6..adf0a5764 100644 --- a/libunbound/libunbound.c +++ b/libunbound/libunbound.c @@ -927,15 +927,13 @@ ub_ctx_set_fwd(struct ub_ctx* ctx, const char* addr) int ub_ctx_set_stub(struct ub_ctx* ctx, const char* zone, const char* addr, int isprime) { - struct sockaddr_storage storage; - socklen_t stlen; - uint8_t* nm; - int nmlabs; - size_t nmlen; char* a; struct config_stub **prev, *elem; /* check syntax for zone name */ + uint8_t* nm; + int nmlabs; + size_t nmlen; if(!parse_dname(zone, &nm, &nmlen, &nmlabs)) { errno=EINVAL; return UB_SYNTAX; /* should have zone name, or "." for root */ @@ -944,9 +942,13 @@ int ub_ctx_set_stub(struct ub_ctx* ctx, const char* zone, const char* addr, nm = NULL; /* check syntax for addr (if not NULL) */ - if(addr!=NULL && !extstrtoaddr(addr, &storage, &stlen)) { - errno=EINVAL; - return UB_SYNTAX; + if(addr) { + struct sockaddr_storage storage; + socklen_t stlen; + if(!extstrtoaddr(addr, &storage, &stlen)) { + errno=EINVAL; + return UB_SYNTAX; + } } lock_basic_lock(&ctx->cfglock); -- 2.47.2