From: naddy Date: Thu, 20 Jan 2022 14:18:10 +0000 (+0000) Subject: remove unused variable from all copies of _asr_strdname() X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=ce6743a3b05387e650bcbabf73c82d33d634a9dc;p=openbsd remove unused variable from all copies of _asr_strdname() ... including those inlined into print_dname(). This also fixes -Wunused-but-set-variable warnings warnings in smtpd and smtpctl. The code was imported with asr and then copied around. ok deraadt@ guenther@ --- diff --git a/lib/libc/asr/asr.c b/lib/libc/asr/asr.c index 7cbf6aab5c9..c4ee2dd103f 100644 --- a/lib/libc/asr/asr.c +++ b/lib/libc/asr/asr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: asr.c,v 1.67 2021/11/22 20:18:27 jca Exp $ */ +/* $OpenBSD: asr.c,v 1.68 2022/01/20 14:18:10 naddy Exp $ */ /* * Copyright (c) 2010-2012 Eric Faurot * @@ -853,7 +853,7 @@ _asr_strdname(const char *_dname, char *buf, size_t max) { const unsigned char *dname = _dname; char *res; - size_t left, n, count; + size_t left, count; if (_dname[0] == 0) { strlcpy(buf, ".", max); @@ -862,7 +862,7 @@ _asr_strdname(const char *_dname, char *buf, size_t max) res = buf; left = max - 1; - for (n = 0; dname[0] && left; n += dname[0]) { + while (dname[0] && left) { count = (dname[0] < (left - 1)) ? dname[0] : (left - 1); memmove(buf, dname + 1, count); dname += dname[0] + 1; diff --git a/regress/lib/libc/asr/bin/res_mkquery.c b/regress/lib/libc/asr/bin/res_mkquery.c index b32f471cdff..ed41e1120df 100644 --- a/regress/lib/libc/asr/bin/res_mkquery.c +++ b/regress/lib/libc/asr/bin/res_mkquery.c @@ -1,4 +1,4 @@ -/* $OpenBSD: res_mkquery.c,v 1.2 2018/12/15 15:16:12 eric Exp $ */ +/* $OpenBSD: res_mkquery.c,v 1.3 2022/01/20 14:18:10 naddy Exp $ */ /* * Copyright (c) 2012 Eric Faurot * @@ -296,7 +296,7 @@ print_dname(const char *_dname, char *buf, size_t max) { const unsigned char *dname = _dname; char *res; - size_t left, n, count; + size_t left, count; if (_dname[0] == 0) { strlcpy(buf, ".", max); @@ -305,7 +305,7 @@ print_dname(const char *_dname, char *buf, size_t max) res = buf; left = max - 1; - for (n = 0; dname[0] && left; n += dname[0]) { + while (dname[0] && left) { count = (dname[0] < (left - 1)) ? dname[0] : (left - 1); memmove(buf, dname + 1, count); dname += dname[0] + 1; diff --git a/regress/lib/libc/asr/bin/res_query.c b/regress/lib/libc/asr/bin/res_query.c index ca95a89a7cc..a2c3686ca35 100644 --- a/regress/lib/libc/asr/bin/res_query.c +++ b/regress/lib/libc/asr/bin/res_query.c @@ -1,4 +1,4 @@ -/* $OpenBSD: res_query.c,v 1.3 2018/12/15 15:16:12 eric Exp $ */ +/* $OpenBSD: res_query.c,v 1.4 2022/01/20 14:18:10 naddy Exp $ */ /* * Copyright (c) 2012 Eric Faurot * @@ -332,7 +332,7 @@ print_dname(const char *_dname, char *buf, size_t max) { const unsigned char *dname = _dname; char *res; - size_t left, n, count; + size_t left, count; if (_dname[0] == 0) { strlcpy(buf, ".", max); @@ -341,7 +341,7 @@ print_dname(const char *_dname, char *buf, size_t max) res = buf; left = max - 1; - for (n = 0; dname[0] && left; n += dname[0]) { + while (dname[0] && left) { count = (dname[0] < (left - 1)) ? dname[0] : (left - 1); memmove(buf, dname + 1, count); dname += dname[0] + 1; diff --git a/usr.sbin/smtpd/unpack_dns.c b/usr.sbin/smtpd/unpack_dns.c index fd7ec6ba6e0..2cde633cd98 100644 --- a/usr.sbin/smtpd/unpack_dns.c +++ b/usr.sbin/smtpd/unpack_dns.c @@ -1,4 +1,4 @@ -/* $OpenBSD: unpack_dns.c,v 1.2 2021/06/14 17:58:16 eric Exp $ */ +/* $OpenBSD: unpack_dns.c,v 1.3 2022/01/20 14:18:10 naddy Exp $ */ /* * Copyright (c) 2011-2014 Eric Faurot @@ -195,7 +195,7 @@ print_dname(const char *_dname, char *buf, size_t max) { const unsigned char *dname = _dname; char *res; - size_t left, n, count; + size_t left, count; if (_dname[0] == 0) { (void)strlcpy(buf, ".", max); @@ -204,7 +204,7 @@ print_dname(const char *_dname, char *buf, size_t max) res = buf; left = max - 1; - for (n = 0; dname[0] && left; n += dname[0]) { + while (dname[0] && left) { count = (dname[0] < (left - 1)) ? dname[0] : (left - 1); memmove(buf, dname + 1, count); dname += dname[0] + 1;