From d958ae799ceb2a35694212712ea44eb5ee94e847 Mon Sep 17 00:00:00 2001 From: jedgar Date: Thu, 21 Feb 2002 23:17:19 +0000 Subject: o style(9) and consistency fixes: - if (!var) -> if (var == NULL) - return val; -> return (val); Reviewed by: rwatson Obtained from: TrustedBSD Project --- lib/libc/posix1e/acl_from_text.c | 10 +++++----- lib/libc/posix1e/acl_get.c | 43 +++++++++++++++++++--------------------- lib/libc/posix1e/acl_init.c | 12 +++++------ lib/libc/posix1e/acl_set.c | 18 ++++++++--------- lib/libc/posix1e/acl_to_text.c | 2 +- 5 files changed, 41 insertions(+), 44 deletions(-) (limited to 'lib/libc/posix1e') diff --git a/lib/libc/posix1e/acl_from_text.c b/lib/libc/posix1e/acl_from_text.c index ffceaa9..78a8bd0 100644 --- a/lib/libc/posix1e/acl_from_text.c +++ b/lib/libc/posix1e/acl_from_text.c @@ -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(¬comment, ","))) { /* 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; } diff --git a/lib/libc/posix1e/acl_get.c b/lib/libc/posix1e/acl_get.c index 4f84cef..94bb0a2 100644 --- a/lib/libc/posix1e/acl_get.c +++ b/lib/libc/posix1e/acl_get.c @@ -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); } diff --git a/lib/libc/posix1e/acl_init.c b/lib/libc/posix1e/acl_init.c index da36156..08b7448 100644 --- a/lib/libc/posix1e/acl_init.c +++ b/lib/libc/posix1e/acl_init.c @@ -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); } diff --git a/lib/libc/posix1e/acl_set.c b/lib/libc/posix1e/acl_set.c index 39fa3a9..c9a2885 100644 --- a/lib/libc/posix1e/acl_set.c +++ b/lib/libc/posix1e/acl_set.c @@ -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); } diff --git a/lib/libc/posix1e/acl_to_text.c b/lib/libc/posix1e/acl_to_text.c index b5e7b92..50b294b 100644 --- a/lib/libc/posix1e/acl_to_text.c +++ b/lib/libc/posix1e/acl_to_text.c @@ -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) { -- cgit v1.1