summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2003-01-28 08:04:40 +0000
committerdes <des@FreeBSD.org>2003-01-28 08:04:40 +0000
commit7a494517a4096a46a570ba094cbd24a7301b549c (patch)
tree3c45c995c4be16b325a0ec0ed6294d455330232a
parent460afc73404cad5304f935c63417e1d5a7dd7f8f (diff)
downloadFreeBSD-src-7a494517a4096a46a570ba094cbd24a7301b549c.zip
FreeBSD-src-7a494517a4096a46a570ba094cbd24a7301b549c.tar.gz
style(9): add parentheses to sizeof even when not strictly required.
MFC after: 3 days
-rw-r--r--lib/libfetch/common.c16
-rw-r--r--lib/libfetch/fetch.c6
-rw-r--r--lib/libfetch/file.c6
-rw-r--r--lib/libfetch/ftp.c12
-rw-r--r--lib/libfetch/http.c4
5 files changed, 22 insertions, 22 deletions
diff --git a/lib/libfetch/common.c b/lib/libfetch/common.c
index beeba0c..c01837a 100644
--- a/lib/libfetch/common.c
+++ b/lib/libfetch/common.c
@@ -206,7 +206,7 @@ _fetch_reopen(int sd)
conn_t *conn;
/* allocate and fill connection structure */
- if ((conn = calloc(1, sizeof *conn)) == NULL)
+ if ((conn = calloc(1, sizeof(*conn))) == NULL)
return (NULL);
conn->sd = sd;
++conn->ref;
@@ -552,7 +552,7 @@ _fetch_putln(conn_t *conn, const char *str, size_t len)
iov[0].iov_base = __DECONST(char *, str);
iov[0].iov_len = len;
iov[1].iov_base = __DECONST(char *, ENDL);
- iov[1].iov_len = sizeof ENDL;
+ iov[1].iov_len = sizeof(ENDL);
if (len == 0)
ret = _fetch_writev(conn, &iov[1], 1);
else
@@ -593,7 +593,7 @@ _fetch_add_entry(struct url_ent **p, int *size, int *len,
}
if (*len >= *size - 1) {
- tmp = realloc(*p, (*size * 2 + 1) * sizeof **p);
+ tmp = realloc(*p, (*size * 2 + 1) * sizeof(**p));
if (tmp == NULL) {
errno = ENOMEM;
_fetch_syserr();
@@ -605,7 +605,7 @@ _fetch_add_entry(struct url_ent **p, int *size, int *len,
tmp = *p + *len;
snprintf(tmp->name, PATH_MAX, "%s", name);
- bcopy(us, &tmp->stat, sizeof *us);
+ bcopy(us, &tmp->stat, sizeof(*us));
(*len)++;
(++tmp)->name[0] = 0;
@@ -638,7 +638,7 @@ _fetch_netrc_auth(struct url *url)
FILE *f;
if ((p = getenv("NETRC")) != NULL) {
- if (snprintf(fn, sizeof fn, "%s", p) >= (int)sizeof(fn)) {
+ if (snprintf(fn, sizeof(fn), "%s", p) >= (int)sizeof(fn)) {
_fetch_info("$NETRC specifies a file name "
"longer than PATH_MAX");
return (-1);
@@ -651,7 +651,7 @@ _fetch_netrc_auth(struct url *url)
(p = pwd->pw_dir) == NULL)
return (-1);
}
- if (snprintf(fn, sizeof fn, "%s/.netrc", p) >= (int)sizeof(fn))
+ if (snprintf(fn, sizeof(fn), "%s/.netrc", p) >= (int)sizeof(fn))
return (-1);
}
@@ -675,7 +675,7 @@ _fetch_netrc_auth(struct url *url)
if (strcmp(word, "login") == 0) {
if ((word = _fetch_read_word(f)) == NULL)
goto ferr;
- if (snprintf(url->user, sizeof url->user,
+ if (snprintf(url->user, sizeof(url->user),
"%s", word) > (int)sizeof(url->user)) {
_fetch_info("login name in .netrc is too long");
url->user[0] = '\0';
@@ -683,7 +683,7 @@ _fetch_netrc_auth(struct url *url)
} else if (strcmp(word, "password") == 0) {
if ((word = _fetch_read_word(f)) == NULL)
goto ferr;
- if (snprintf(url->pwd, sizeof url->pwd,
+ if (snprintf(url->pwd, sizeof(url->pwd),
"%s", word) > (int)sizeof(url->pwd)) {
_fetch_info("password in .netrc is too long");
url->pwd[0] = '\0';
diff --git a/lib/libfetch/fetch.c b/lib/libfetch/fetch.c
index fd44ad5..59ee8a8 100644
--- a/lib/libfetch/fetch.c
+++ b/lib/libfetch/fetch.c
@@ -274,7 +274,7 @@ fetchMakeURL(const char *scheme, const char *host, int port, const char *doc,
}
/* allocate struct url */
- if ((u = calloc(1, sizeof *u)) == NULL) {
+ if ((u = calloc(1, sizeof(*u))) == NULL) {
_fetch_syserr();
return (NULL);
}
@@ -285,7 +285,7 @@ fetchMakeURL(const char *scheme, const char *host, int port, const char *doc,
return (NULL);
}
-#define seturl(x) snprintf(u->x, sizeof u->x, "%s", x)
+#define seturl(x) snprintf(u->x, sizeof(u->x), "%s", x)
seturl(scheme);
seturl(host);
seturl(user);
@@ -310,7 +310,7 @@ fetchParseURL(const char *URL)
int i;
/* allocate struct url */
- if ((u = calloc(1, sizeof *u)) == NULL) {
+ if ((u = calloc(1, sizeof(*u))) == NULL) {
_fetch_syserr();
return (NULL);
}
diff --git a/lib/libfetch/file.c b/lib/libfetch/file.c
index 085f232..d73159a 100644
--- a/lib/libfetch/file.c
+++ b/lib/libfetch/file.c
@@ -127,11 +127,11 @@ fetchListFile(struct url *u, const char *flags __unused)
}
ue = NULL;
- strncpy(fn, u->doc, sizeof fn - 2);
- fn[sizeof fn - 2] = 0;
+ strncpy(fn, u->doc, sizeof(fn) - 2);
+ fn[sizeof(fn) - 2] = 0;
strcat(fn, "/");
p = strchr(fn, 0);
- l = sizeof fn - strlen(fn) - 1;
+ l = sizeof(fn) - strlen(fn) - 1;
while ((de = readdir(dir)) != NULL) {
strncpy(p, de->d_name, l - 1);
diff --git a/lib/libfetch/ftp.c b/lib/libfetch/ftp.c
index 37878bd..56d0bf5 100644
--- a/lib/libfetch/ftp.c
+++ b/lib/libfetch/ftp.c
@@ -434,7 +434,7 @@ _ftp_setup(conn_t *cconn, conn_t *dconn, int mode)
if (cconn == NULL || dconn == NULL)
return (NULL);
- if ((io = malloc(sizeof *io)) == NULL)
+ if ((io = malloc(sizeof(*io))) == NULL)
return (NULL);
io->cconn = cconn;
io->dconn = dconn;
@@ -473,7 +473,7 @@ _ftp_transfer(conn_t *conn, const char *oper, const char *file,
strncasecmp(s, "no", 2) != 0);
/* find our own address, bind, and listen */
- l = sizeof sa;
+ l = sizeof(sa);
if (getsockname(conn->sd, (struct sockaddr *)&sa, &l) == -1)
goto sysouch;
if (sa.ss_family == AF_INET6)
@@ -559,7 +559,7 @@ _ftp_transfer(conn_t *conn, const char *oper, const char *file,
goto sysouch;
/* construct sockaddr for data socket */
- l = sizeof sa;
+ l = sizeof(sa);
if (getpeername(conn->sd, (struct sockaddr *)&sa, &l) == -1)
goto sysouch;
if (sa.ss_family == AF_INET6)
@@ -622,7 +622,7 @@ _ftp_transfer(conn_t *conn, const char *oper, const char *file,
((struct sockaddr_in *)&sa)->sin_port = 0;
arg = low ? IP_PORTRANGE_DEFAULT : IP_PORTRANGE_HIGH;
if (setsockopt(sd, IPPROTO_IP, IP_PORTRANGE,
- (char *)&arg, sizeof arg) == -1)
+ (char *)&arg, sizeof(arg)) == -1)
goto sysouch;
break;
}
@@ -756,7 +756,7 @@ _ftp_authenticate(conn_t *conn, struct url *url, struct url *purl)
len = 0;
else if (len > MAXLOGNAME)
len = MAXLOGNAME;
- gethostname(pbuf + len, sizeof pbuf - len);
+ gethostname(pbuf + len, sizeof(pbuf) - len);
pwd = pbuf;
}
e = _ftp_cmd(conn, "PASS %s", pwd);
@@ -881,7 +881,7 @@ _ftp_cached_connect(struct url *url, struct url *purl, const char *flags)
if (cached_connection)
_ftp_disconnect(cached_connection);
cached_connection = _fetch_ref(conn);
- memcpy(&cached_host, url, sizeof *url);
+ memcpy(&cached_host, url, sizeof(*url));
return (conn);
}
diff --git a/lib/libfetch/http.c b/lib/libfetch/http.c
index 8eebb83..5f44c53 100644
--- a/lib/libfetch/http.c
+++ b/lib/libfetch/http.c
@@ -304,7 +304,7 @@ _http_funopen(conn_t *conn, int chunked)
struct httpio *io;
FILE *f;
- if ((io = calloc(1, sizeof *io)) == NULL) {
+ if ((io = calloc(1, sizeof(*io))) == NULL) {
_fetch_syserr();
return (NULL);
}
@@ -470,7 +470,7 @@ _http_parse_mtime(const char *p, time_t *mtime)
char locale[64], *r;
struct tm tm;
- strncpy(locale, setlocale(LC_TIME, NULL), sizeof locale);
+ strncpy(locale, setlocale(LC_TIME, NULL), sizeof(locale));
setlocale(LC_TIME, "C");
r = strptime(p, "%a, %d %b %Y %H:%M:%S GMT", &tm);
/* XXX should add support for date-2 and date-3 */
OpenPOWER on IntegriCloud