goto formerr;
x = (x<<4) | (s - hex);
if (++n == 2) {
- if (len > 0) {
+ if (len > 0U) {
*buf++ = x;
len--;
} else
{
size_t i = 0;
- if (len1 < 4)
+ if (len1 < 4U)
len1 = 4;
- if (len2 < 4)
+ if (len2 < 4U)
len2 = 4;
- while (buflen > 0) {
+ while (buflen > 0U) {
fputc(hex[(buf[0]>>4)&0xf], fp);
fputc(hex[buf[0]&0xf], fp);
i += 2;
void
isc_tohex(const unsigned char *buf, size_t buflen, char *t) {
- while (buflen > 0) {
+ while (buflen > 0U) {
*t++ = hex[(buf[0]>>4)&0xf];
*t++ = hex[buf[0]&0xf];
buf++;
#if !defined(LINT) && !defined(CODECENTER)
-static const char rcsid[] = "$Id: memcluster.c,v 1.3.2.1 2004/03/09 09:17:36 marka Exp $";
+static const char rcsid[] = "$Id: memcluster.c,v 1.3.2.2 2004/03/16 12:35:31 marka Exp $";
#endif /* not lint */
#include "port_before.h"
errno = EEXIST;
return (-1);
}
- if (init_max_size == 0)
+ if (init_max_size == 0U)
max_size = DEF_MAX_SIZE;
else
max_size = init_max_size;
- if (target_size == 0)
+ if (target_size == 0U)
mem_target = DEF_MEM_TARGET;
else
mem_target = target_size;
if (freelists == NULL)
if (meminit(0, 0) == -1)
return (NULL);
- if (size == 0) {
+ if (size == 0U) {
errno = EINVAL;
return (NULL);
}
REQUIRE(freelists != NULL);
- if (size == 0) {
+ if (size == 0U) {
errno = EINVAL;
return;
}
* max. size (max_size) ends up getting recorded as a call to
* max_size.
*/
- INSIST(stats[size].gets != 0);
+ INSIST(stats[size].gets != 0U);
stats[size].gets--;
stats[new_size].freefrags++;
}
for (i = 1; i <= max_size; i++) {
const struct stats *s = &stats[i];
- if (s->totalgets == 0 && s->gets == 0)
+ if (s->totalgets == 0U && s->gets == 0U)
continue;
fprintf(out, "%s%5d: %11lu gets, %11lu rem",
(i == max_size) ? ">=" : " ",
i, s->totalgets, s->gets);
- if (s->blocks != 0)
+ if (s->blocks != 0U)
fprintf(out, " (%lu bl, %lu ff)",
s->blocks, s->freefrags);
fputc('\n', out);
if (stats == NULL)
return (0);
for (i = 1; i <= max_size; i++)
- if (stats[i].gets != 0)
+ if (stats[i].gets != 0U)
return (1);
return (0);
}
*/
#ifndef lint
-static const char rcsid[] = "$Id: ns_date.c,v 1.3.2.1 2004/03/09 09:17:37 marka Exp $";
+static const char rcsid[] = "$Id: ns_date.c,v 1.3.2.2 2004/03/16 12:35:32 marka Exp $";
#endif
/* Import. */
static const int days_per_month[12] =
{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
- if (strlen(cp) != 14) {
+ if (strlen(cp) != 14U) {
*errp = 1;
return (0);
}
*/
#ifndef lint
-static const char rcsid[] = "$Id: ns_print.c,v 1.3.2.2 2004/03/09 09:17:37 marka Exp $";
+static const char rcsid[] = "$Id: ns_print.c,v 1.3.2.3 2004/03/16 12:35:32 marka Exp $";
#endif
/* Import. */
u_int order, preference;
char t[50];
- if (rdlen < 2*NS_INT16SZ)
+ if (rdlen < 2U*NS_INT16SZ)
goto formerr;
/* Order, Precedence. */
u_int priority, weight, port;
char t[50];
- if (rdlen < NS_INT16SZ*3)
+ if (rdlen < 3U*NS_INT16SZ)
goto formerr;
/* Priority, Weight, Port. */
case ns_t_wks: {
int n, lcnt;
- if (rdlen < NS_INT32SZ + 1)
+ if (rdlen < 1U + NS_INT32SZ)
goto formerr;
/* Address. */
const char *leader;
int n;
- if (rdlen < NS_INT16SZ + NS_INT8SZ + NS_INT8SZ)
+ if (rdlen < 0U + NS_INT16SZ + NS_INT8SZ + NS_INT8SZ)
goto formerr;
/* Key flags, Protocol, Algorithm. */
u_long t;
int n;
- if (rdlen < 22)
+ if (rdlen < 22U)
goto formerr;
/* Type covered, Algorithm, Label count, Original TTL. */
int pbyte, pbit;
/* prefix length */
- if (rdlen == 0) goto formerr;
+ if (rdlen == 0U) goto formerr;
len = SPRINTF((tmp, "%d ", *rdata));
T(addstr(tmp, len, &buf, &buflen));
pbit = *rdata;
newlen = prune_origin(*buf, origin);
if (**buf == '\0') {
goto root;
- } else if (newlen == 0) {
+ } else if (newlen == 0U) {
/* Use "@" instead of name. */
if (newlen + 2 > *buflen)
goto enospc; /* No room for "@\0". */
*/
#ifndef lint
-static const char rcsid[] = "$Id: ns_samedomain.c,v 1.1.2.3 2004/03/09 09:17:37 marka Exp $";
+static const char rcsid[] = "$Id: ns_samedomain.c,v 1.1.2.4 2004/03/16 12:35:33 marka Exp $";
#endif
#include "port_before.h"
lb = strlen(b);
/* Ignore a trailing label separator (i.e. an unescaped dot) in 'a'. */
- if (la != 0 && a[la - 1] == '.') {
+ if (la != 0U && a[la - 1] == '.') {
escaped = 0;
/* Note this loop doesn't get executed if la==1. */
for (i = la - 2; i >= 0; i--)
}
/* Ignore a trailing label separator (i.e. an unescaped dot) in 'b'. */
- if (lb != 0 && b[lb - 1] == '.') {
+ if (lb != 0U && b[lb - 1] == '.') {
escaped = 0;
/* note this loop doesn't get executed if lb==1 */
for (i = lb - 2; i >= 0; i--)
}
/* lb == 0 means 'b' is the root domain, so 'a' must be in 'b'. */
- if (lb == 0)
+ if (lb == 0U)
return (1);
/* 'b' longer than 'a' means 'a' can't be in 'b'. */
return (-1);
}
strcpy(dst, src);
- while (n >= 1 && dst[n - 1] == '.') /* Ends in "." */
- if (n >= 2 && dst[n - 2] == '\\' && /* Ends in "\." */
- (n < 3 || dst[n - 3] != '\\')) /* But not "\\." */
+ while (n >= 1U && dst[n - 1] == '.') /* Ends in "." */
+ if (n >= 2U && dst[n - 2] == '\\' && /* Ends in "\." */
+ (n < 3U || dst[n - 3] != '\\')) /* But not "\\." */
break;
else
dst[--n] = '\0';
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$Id: res_data.c,v 1.1.2.1 2004/03/09 09:17:49 marka Exp $";
+static const char rcsid[] = "$Id: res_data.c,v 1.1.2.2 2004/03/16 12:35:33 marka Exp $";
#endif /* LIBC_SCCS and not lint */
#include "port_before.h"
void
fp_nquery(const u_char *msg, int len, FILE *file) {
- if ((_res.options & RES_INIT) == 0 && res_init() == -1)
+ if ((_res.options & RES_INIT) == 0U && res_init() == -1)
return;
res_pquery(&_res, msg, len, file);
u_char *buf, /* buffer to put query */
int buflen) /* size of buffer */
{
- if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
+ if ((_res.options & RES_INIT) == 0U && res_init() == -1) {
RES_SET_H_ERRNO(&_res, NETDB_INTERNAL);
return (-1);
}
int
res_mkupdate(ns_updrec *rrecp_in, u_char *buf, int buflen) {
- if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
+ if ((_res.options & RES_INIT) == 0U && res_init() == -1) {
RES_SET_H_ERRNO(&_res, NETDB_INTERNAL);
return (-1);
}
u_char *answer, /* buffer to put answer */
int anslen) /* size of answer buffer */
{
- if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
+ if ((_res.options & RES_INIT) == 0U && res_init() == -1) {
RES_SET_H_ERRNO(&_res, NETDB_INTERNAL);
return (-1);
}
int
res_send(const u_char *buf, int buflen, u_char *ans, int anssiz) {
- if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
+ if ((_res.options & RES_INIT) == 0U && res_init() == -1) {
/* errno should have been set by res_init() in this case. */
return (-1);
}
res_sendsigned(const u_char *buf, int buflen, ns_tsig_key *key,
u_char *ans, int anssiz)
{
- if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
+ if ((_res.options & RES_INIT) == 0U && res_init() == -1) {
/* errno should have been set by res_init() in this case. */
return (-1);
}
int
res_update(ns_updrec *rrecp_in) {
- if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
+ if ((_res.options & RES_INIT) == 0U && res_init() == -1) {
RES_SET_H_ERRNO(&_res, NETDB_INTERNAL);
return (-1);
}
u_char *answer, /* buffer to put answer */
int anslen) /* size of answer */
{
- if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
+ if ((_res.options & RES_INIT) == 0U && res_init() == -1) {
RES_SET_H_ERRNO(&_res, NETDB_INTERNAL);
return (-1);
}
u_char *answer, /* buffer to put answer */
int anslen) /* size of answer */
{
- if ((_res.options & RES_INIT) == 0 && res_init() == -1) {
+ if ((_res.options & RES_INIT) == 0U && res_init() == -1) {
RES_SET_H_ERRNO(&_res, NETDB_INTERNAL);
return (-1);
}
#if defined(LIBC_SCCS) && !defined(lint)
static const char sccsid[] = "@(#)res_debug.c 8.1 (Berkeley) 6/4/93";
-static const char rcsid[] = "$Id: res_debug.c,v 1.3.2.6 2004/03/09 09:17:49 marka Exp $";
+static const char rcsid[] = "$Id: res_debug.c,v 1.3.2.7 2004/03/16 12:35:34 marka Exp $";
#endif /* LIBC_SCCS and not lint */
#include "port_before.h"
u_long mask;
fprintf(file, ";; res options:");
- for (mask = 1; mask != 0; mask <<= 1)
+ for (mask = 1; mask != 0U; mask <<= 1)
if (statp->options & mask)
fprintf(file, " %s", p_option(mask));
putc('\n', file);
sprintf(ret, "[af%d]", u.sin.sin_family);
break;
}
- if (size > 0) {
+ if (size > 0U) {
strncpy(buf, ret, size - 1);
buf[size - 1] = '0';
}
goto done;
errno = 0;
result = strtoul(buf + 5, &endptr, 10);
- if (errno == 0 && *endptr == '\0' && result <= 0xffff)
+ if (errno == 0 && *endptr == '\0' && result <= 0xffffU)
success = 1;
done:
if (successp)
goto done;
errno = 0;
result = strtoul(buf + 4, &endptr, 10);
- if (errno == 0 && *endptr == '\0' && result <= 0xffff)
+ if (errno == 0 && *endptr == '\0' && result <= 0xffffU)
success = 1;
done:
if (successp)
#if !defined(lint) && !defined(SABER)
-static const char rcsid[] = "$Id: res_findzonecut.c,v 1.2.2.4 2004/03/09 09:17:49 marka Exp $";
+static const char rcsid[] = "$Id: res_findzonecut.c,v 1.2.2.5 2004/03/16 12:35:34 marka Exp $";
#endif /* not lint */
/*
#define DPRINTF(x) do {\
int save_errno = errno; \
- if ((statp->options & RES_DEBUG) != 0) res_dprintf x; \
+ if ((statp->options & RES_DEBUG) != 0U) res_dprintf x; \
errno = save_errno; \
} while (0)
#if defined(LIBC_SCCS) && !defined(lint)
static const char sccsid[] = "@(#)res_init.c 8.1 (Berkeley) 6/7/93";
-static const char rcsid[] = "$Id: res_init.c,v 1.9.2.6 2004/03/09 09:17:49 marka Exp $";
+static const char rcsid[] = "$Id: res_init.c,v 1.9.2.7 2004/03/16 12:35:35 marka Exp $";
#endif /* LIBC_SCCS and not lint */
#include "port_before.h"
statp->id = res_randomid();
}
- if ((statp->options & RES_INIT) != 0)
+ if ((statp->options & RES_INIT) != 0U)
res_ndestroy(statp);
memset(u, 0, sizeof(u));
#if defined(LIBC_SCCS) && !defined(lint)
static const char sccsid[] = "@(#)res_mkquery.c 8.1 (Berkeley) 6/4/93";
-static const char rcsid[] = "$Id: res_mkquery.c,v 1.1.2.3 2004/03/09 09:17:49 marka Exp $";
+static const char rcsid[] = "$Id: res_mkquery.c,v 1.1.2.4 2004/03/16 12:35:35 marka Exp $";
#endif /* LIBC_SCCS and not lint */
#include "port_before.h"
hp = (HEADER *) buf;
hp->id = htons(++statp->id);
hp->opcode = op;
- hp->rd = (statp->options & RES_RECURSE) != 0;
+ hp->rd = (statp->options & RES_RECURSE) != 0U;
hp->rcode = NOERROR;
cp = buf + HFIXEDSZ;
ep = buf + buflen;
u_int16_t flags = 0;
#ifdef DEBUG
- if ((statp->options & RES_DEBUG) != 0)
+ if ((statp->options & RES_DEBUG) != 0U)
printf(";; res_nopt()\n");
#endif
*/
#if !defined(lint) && !defined(SABER)
-static const char rcsid[] = "$Id: res_mkupdate.c,v 1.1.2.2 2004/03/09 09:17:49 marka Exp $";
+static const char rcsid[] = "$Id: res_mkupdate.c,v 1.1.2.3 2004/03/16 12:35:36 marka Exp $";
#endif /* not lint */
#include "port_before.h"
}
break;
case T_TXT:
- while (1) {
+ for (;;) {
if ((n = getstr_str(buf2, sizeof buf2,
&startp, endp)) < 0) {
if (cp != (sp2 + INT16SZ))
ShrinkBuffer(n);
maxtype = 0;
memset(data, 0, sizeof data);
- while (1) {
+ for (;;) {
if (!getword_str(buf2, sizeof buf2, &startp,
endp))
break;
#if defined(LIBC_SCCS) && !defined(lint)
static const char sccsid[] = "@(#)res_query.c 8.1 (Berkeley) 6/4/93";
-static const char rcsid[] = "$Id: res_query.c,v 1.2.2.4 2004/03/09 09:17:50 marka Exp $";
+static const char rcsid[] = "$Id: res_query.c,v 1.2.2.5 2004/03/16 12:35:36 marka Exp $";
#endif /* LIBC_SCCS and not lint */
#include "port_before.h"
buf, sizeof(buf));
#ifdef RES_USE_EDNS0
if (n > 0 && (statp->_flags & RES_F_EDNS0ERR) == 0 &&
- (statp->options & (RES_USE_EDNS0|RES_USE_DNSSEC)) != 0)
+ (statp->options & (RES_USE_EDNS0|RES_USE_DNSSEC)) != 0U)
n = res_nopt(statp, n, buf, sizeof(buf), anslen);
#endif
if (n <= 0) {
if (n < 0) {
#ifdef RES_USE_EDNS0
/* if the query choked with EDNS0, retry without EDNS0 */
- if ((statp->options & (RES_USE_EDNS0|RES_USE_DNSSEC)) != 0 &&
+ if ((statp->options & (RES_USE_EDNS0|RES_USE_DNSSEC)) != 0U &&
((oflags ^ statp->_flags) & RES_F_EDNS0ERR) != 0) {
statp->_flags |= RES_F_EDNS0ERR;
if (statp->options & RES_DEBUG)
* - there is at least one dot, there is no trailing dot,
* and RES_DNSRCH is set.
*/
- if ((!dots && (statp->options & RES_DEFNAMES) != 0) ||
- (dots && !trailing_dot && (statp->options & RES_DNSRCH) != 0)) {
+ if ((!dots && (statp->options & RES_DEFNAMES) != 0U) ||
+ (dots && !trailing_dot && (statp->options & RES_DNSRCH) != 0U)) {
int done = 0;
for (domain = (const char * const *)statp->dnsrch;
/* if we got here for some reason other than DNSRCH,
* we only wanted one iteration of the loop, so stop.
*/
- if ((statp->options & RES_DNSRCH) == 0)
+ if ((statp->options & RES_DNSRCH) == 0U)
done++;
}
}
* If the query has not already been tried as is then try it
* unless RES_NOTLDQUERY is set and there were no dots.
*/
- if ((dots || !searched || (statp->options & RES_NOTLDQUERY) == 0) &&
+ if ((dots || !searched || (statp->options & RES_NOTLDQUERY) == 0U) &&
!(tried_as_is || root_on_list)) {
ret = res_nquerydomain(statp, name, NULL, class, type,
answer, anslen);
#if defined(LIBC_SCCS) && !defined(lint)
static const char sccsid[] = "@(#)res_send.c 8.1 (Berkeley) 6/4/93";
-static const char rcsid[] = "$Id: res_send.c,v 1.5.2.3 2004/03/09 09:17:50 marka Exp $";
+static const char rcsid[] = "$Id: res_send.c,v 1.5.2.4 2004/03/16 12:35:37 marka Exp $";
#endif /* LIBC_SCCS and not lint */
/*
* Some resolvers want to even out the load on their nameservers.
* Note that RES_BLAST overrides RES_ROTATE.
*/
- if ((statp->options & RES_ROTATE) != 0 &&
- (statp->options & RES_BLAST) == 0) {
+ if ((statp->options & RES_ROTATE) != 0U &&
+ (statp->options & RES_BLAST) == 0U) {
union res_sockaddr_union inu;
struct sockaddr_in ina;
int lastns = statp->nscount - 1;
* or if we haven't been asked to keep a socket open,
* close the socket.
*/
- if ((v_circuit && (statp->options & RES_USEVC) == 0) ||
- (statp->options & RES_STAYOPEN) == 0) {
+ if ((v_circuit && (statp->options & RES_USEVC) == 0U) ||
+ (statp->options & RES_STAYOPEN) == 0U) {
res_nclose(statp);
}
if (statp->rhook) {
goto wait;
}
#ifdef RES_USE_EDNS0
- if (anhp->rcode == FORMERR && (statp->options & RES_USE_EDNS0) != 0) {
+ if (anhp->rcode == FORMERR && (statp->options & RES_USE_EDNS0) != 0U) {
/*
* Do not retry if the server do not understand EDNS0.
* The case has to be captured here, as FORMERR packet do not
alen = alen;
- if ((statp->options & RES_DEBUG) != 0) {
+ if ((statp->options & RES_DEBUG) != 0U) {
if (getnameinfo(address, alen, hbuf, sizeof(hbuf),
sbuf, sizeof(sbuf), niflags)) {
strncpy(hbuf, "?", sizeof(hbuf) - 1);
Perror(const res_state statp, FILE *file, const char *string, int error) {
int save = errno;
- if ((statp->options & RES_DEBUG) != 0)
+ if ((statp->options & RES_DEBUG) != 0U)
fprintf(file, "res_send: %s: %s\n",
string, strerror(error));
errno = save;
}
hp = (HEADER *) answer;
- if (hp->tc && !usingTCP && (statp->options & RES_IGNTC) == 0) {
+ if (hp->tc && !usingTCP && (statp->options & RES_IGNTC) == 0U) {
nstatp->options &= ~RES_IGNTC;
usingTCP = 1;
goto retry;
#if !defined(lint) && !defined(SABER)
-static const char rcsid[] = "$Id: res_update.c,v 1.6.2.5 2004/03/09 09:17:50 marka Exp $";
+static const char rcsid[] = "$Id: res_update.c,v 1.6.2.6 2004/03/16 12:35:37 marka Exp $";
#endif /* not lint */
/*
#define DPRINTF(x) do {\
int save_errno = errno; \
- if ((statp->options & RES_DEBUG) != 0) res_dprintf x; \
+ if ((statp->options & RES_DEBUG) != 0U) res_dprintf x; \
errno = save_errno; \
} while (0)