1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-19 10:53:58 +00:00

o style(9) and consistency fixes:

- if (!var) -> if (var == NULL)
  - return val; -> return (val);

Reviewed by:	rwatson
Obtained from:	TrustedBSD Project
This commit is contained in:
Chris D. Faulhaber 2002-02-21 23:17:19 +00:00
parent e146d0bc6a
commit 9fd46b0237
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=91034
5 changed files with 41 additions and 44 deletions

View File

@ -123,11 +123,11 @@ acl_from_text(const char *buf_p)
/* Local copy we can mess up. */
mybuf_p = strdup(buf_p);
if (!mybuf_p)
if (mybuf_p == NULL)
return(NULL);
acl = acl_init(3);
if (!acl) {
if (acl == NULL) {
free(mybuf_p);
return(NULL);
}
@ -143,7 +143,7 @@ acl_from_text(const char *buf_p)
while ((entry = strsep(&notcomment, ","))) {
/* Now split into three ':' delimited fields. */
tag = strsep(&entry, ":");
if (!tag) {
if (tag == NULL) {
errno = EINVAL;
goto error_label;
}
@ -158,7 +158,7 @@ acl_from_text(const char *buf_p)
string_trim_trailing_whitespace(tag);
qualifier = strsep(&entry, ":");
if (!qualifier) {
if (qualifier == NULL) {
errno = EINVAL;
goto error_label;
}
@ -166,7 +166,7 @@ acl_from_text(const char *buf_p)
string_trim_trailing_whitespace(qualifier);
permission = strsep(&entry, ":");
if ((!permission) || (entry)) {
if (permission == NULL || entry) {
errno = EINVAL;
goto error_label;
}

View File

@ -52,9 +52,8 @@ acl_get_file(const char *path_p, acl_type_t type)
int error;
aclp = acl_init(ACL_MAX_ENTRIES);
if (!aclp) {
if (aclp == NULL)
return (NULL);
}
error = __acl_get_file(path_p, type, &aclp->ats_acl);
if (error) {
@ -72,9 +71,8 @@ acl_get_fd(int fd)
int error;
aclp = acl_init(ACL_MAX_ENTRIES);
if (!aclp) {
if (aclp == NULL)
return (NULL);
}
error = ___acl_get_fd(fd, ACL_TYPE_ACCESS, &aclp->ats_acl);
if (error) {
@ -92,9 +90,8 @@ acl_get_fd_np(int fd, acl_type_t type)
int error;
aclp = acl_init(ACL_MAX_ENTRIES);
if (!aclp) {
if (aclp == NULL)
return (NULL);
}
error = ___acl_get_fd(fd, type, &aclp->ats_acl);
if (error) {
@ -109,9 +106,9 @@ int
acl_get_perm_np(acl_permset_t permset_d, acl_perm_t perm)
{
if (!permset_d) {
if (permset_d == NULL) {
errno = EINVAL;
return -1;
return (-1);
}
switch(perm) {
@ -119,14 +116,14 @@ acl_get_perm_np(acl_permset_t permset_d, acl_perm_t perm)
case ACL_WRITE:
case ACL_EXECUTE:
if (*permset_d & perm)
return 1;
return (1);
break;
default:
errno = EINVAL;
return -1;
return (-1);
}
return 0;
return (0);
}
/*
@ -137,14 +134,14 @@ int
acl_get_permset(acl_entry_t entry_d, acl_permset_t *permset_p)
{
if (!entry_d || !permset_p) {
if (entry_d == NULL || permset_p == NULL) {
errno = EINVAL;
return -1;
return (-1);
}
*permset_p = &entry_d->ae_perm;
return 0;
return (0);
}
/*
@ -156,23 +153,23 @@ acl_get_qualifier(acl_entry_t entry_d)
{
uid_t *retval;
if (!entry_d) {
if (entry_d == NULL) {
errno = EINVAL;
return NULL;
return (NULL);
}
switch(entry_d->ae_tag) {
case ACL_USER:
case ACL_GROUP:
retval = malloc(sizeof(uid_t));
if (!retval)
return NULL;
if (retval == NULL)
return (NULL);
*retval = entry_d->ae_id;
return retval;
return (retval);
}
errno = EINVAL;
return NULL;
return (NULL);
}
/*
@ -183,12 +180,12 @@ int
acl_get_tag_type(acl_entry_t entry_d, acl_tag_t *tag_type_p)
{
if (!entry_d || !tag_type_p) {
if (entry_d == NULL || tag_type_p == NULL) {
errno = EINVAL;
return -1;
return (-1);
}
*tag_type_p = entry_d->ae_tag;
return 0;
return (0);
}

View File

@ -65,11 +65,11 @@ acl_dup(acl_t acl)
acl_t acl_new;
acl_new = acl_init(ACL_MAX_ENTRIES);
if (!acl_new)
return NULL;
*acl_new = *acl;
acl->ats_cur_entry = 0;
acl_new->ats_cur_entry = 0;
if (acl_new != NULL) {
*acl_new = *acl;
acl->ats_cur_entry = 0;
acl_new->ats_cur_entry = 0;
}
return(acl_new);
return (acl_new);
}

View File

@ -112,12 +112,12 @@ acl_set_permset(acl_entry_t entry_d, acl_permset_t permset_d)
if (!entry_d) {
errno = EINVAL;
return -1;
return (-1);
}
entry_d->ae_perm = *permset_d;
return 0;
return (0);
}
/*
@ -129,7 +129,7 @@ acl_set_qualifier(acl_entry_t entry_d, const void *tag_qualifier_p)
{
if (!entry_d || !tag_qualifier_p) {
errno = EINVAL;
return -1;
return (-1);
}
switch(entry_d->ae_tag) {
@ -139,10 +139,10 @@ acl_set_qualifier(acl_entry_t entry_d, const void *tag_qualifier_p)
break;
default:
errno = EINVAL;
return -1;
return (-1);
}
return 0;
return (0);
}
/*
@ -153,9 +153,9 @@ int
acl_set_tag_type(acl_entry_t entry_d, acl_tag_t tag_type)
{
if (!entry_d) {
if (entry_d == NULL) {
errno = EINVAL;
return -1;
return (-1);
}
switch(tag_type) {
@ -166,9 +166,9 @@ acl_set_tag_type(acl_entry_t entry_d, acl_tag_t tag_type)
case ACL_MASK:
case ACL_OTHER:
entry_d->ae_tag = tag_type;
return 0;
return (0);
}
errno = EINVAL;
return -1;
return (-1);
}

View File

@ -63,7 +63,7 @@ acl_to_text(acl_t acl, ssize_t *len_p)
acl_perm_t ae_perm, effective_perm, mask_perm;
buf = strdup("");
if (!buf)
if (buf == NULL)
return(NULL);
if (acl == NULL) {