Use 'sizeof(foo)' instead of 'sizeof foo' even where it's not

required.  Although style(9) doesn't say anything about it, this
seems to be the preferred form.

Sponsored by:	DARPA, NAI Labs


git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@19 185d5e19-27fe-0310-9dcf-9bff6b9f3609
This commit is contained in:
Dag-Erling Smørgrav 2002-02-02 18:04:31 +00:00
parent a980e1d3da
commit 99d01aea5e
5 changed files with 7 additions and 7 deletions

View File

@ -92,7 +92,7 @@ main(int argc, char *argv[])
pam_start("su", argc ? *argv : "root", &pamc, &pamh);
/* set some items */
gethostname(hostname, sizeof hostname);
gethostname(hostname, sizeof(hostname));
check("pam_set_item", pam_set_item(pamh, PAM_RHOST, hostname));
user = getlogin();
check("pam_set_item", pam_set_item(pamh, PAM_RUSER, user));

View File

@ -64,7 +64,7 @@ openpam_ttyconv(int n,
data = data;
if (n <= 0 || n > PAM_MAX_NUM_MSG)
return (PAM_CONV_ERR);
if ((*resp = calloc(n, sizeof **resp)) == NULL)
if ((*resp = calloc(n, sizeof(**resp))) == NULL)
return (PAM_BUF_ERR);
fd = fileno(stdin);
for (i = 0; i < n; ++i) {
@ -91,7 +91,7 @@ openpam_ttyconv(int n,
}
fputs(msg[i]->msg, stderr);
buf[0] = '\0';
fgets(buf, sizeof buf, stdin);
fgets(buf, sizeof(buf), stdin);
if (msg[i]->msg_style == PAM_PROMPT_ECHO_OFF) {
tattr.c_lflag = lflag;
(void)tcsetattr(fd, TCSANOW, &tattr);

View File

@ -71,7 +71,7 @@ pam_set_data(pam_handle_t *pamh,
}
}
if ((dp = malloc(sizeof *dp)) == NULL)
if ((dp = malloc(sizeof(*dp))) == NULL)
return (PAM_BUF_ERR);
if ((dp->name = strdup(module_data_name)) == NULL) {
free(data);

View File

@ -65,7 +65,7 @@ pam_start(const char *service,
struct pam_handle *ph;
int r;
if ((ph = calloc(1, sizeof *ph)) == NULL)
if ((ph = calloc(1, sizeof(*ph))) == NULL)
return (PAM_BUF_ERR);
if ((r = pam_set_item(ph, PAM_SERVICE, service)) != PAM_SUCCESS)
goto fail;
@ -110,7 +110,7 @@ _pam_add_module(pam_handle_t *pamh,
int i;
/* fill in configuration data */
if ((module = malloc(sizeof *module)) == NULL) {
if ((module = malloc(sizeof(*module))) == NULL) {
openpam_log(PAM_LOG_ERROR, "malloc(): %m");
return (PAM_BUF_ERR);
}

View File

@ -117,7 +117,7 @@ pam_strerror(pam_handle_t *pamh,
case PAM_DOMAIN_UNKNOWN:
return ("unknown authentication domain");
default:
snprintf(unknown, sizeof unknown, "#%d", error_number);
snprintf(unknown, sizeof(unknown), "#%d", error_number);
return (unknown);
}
}