summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
authorToomas Soome <tsoome@me.com>2022-10-04 14:53:55 +0300
committerToomas Soome <tsoome@me.com>2022-10-24 20:23:37 +0300
commit00ae59338e3e57fe8bfe8118360a47a69bfd8b98 (patch)
tree7af6cffaec3a4ec189509065895d615b35e7e6bc /usr/src
parent1a613b61205f4ee9a9fb00184dbe6cae17a6ede7 (diff)
downloadillumos-joyent-00ae59338e3e57fe8bfe8118360a47a69bfd8b98.tar.gz
15054 libc: using the result of an assignment as a condition without parentheses
Reviewed by: Gordon Ross <gordon.w.ross@gmail.com> Approved by: Dan McDonald <danmcd@mnx.io>
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/lib/libc/amd64/unwind/call_frame_inst.c26
-rw-r--r--usr/src/lib/libc/port/gen/_xftw.c2
-rw-r--r--usr/src/lib/libc/port/gen/attrat.c4
-rw-r--r--usr/src/lib/libc/port/gen/catopen.c4
-rw-r--r--usr/src/lib/libc/port/gen/ctime.c6
-rw-r--r--usr/src/lib/libc/port/gen/fmtmsg.c36
-rw-r--r--usr/src/lib/libc/port/gen/getut.c6
-rw-r--r--usr/src/lib/libc/port/gen/getutx.c4
-rw-r--r--usr/src/lib/libc/port/gen/nftw.c2
-rw-r--r--usr/src/lib/libc/port/gen/nlspath_checks.c5
-rw-r--r--usr/src/lib/libc/port/gen/nsparse.c90
-rw-r--r--usr/src/lib/libc/port/gen/rctlops.c5
-rw-r--r--usr/src/lib/libc/port/gen/regexpr.c16
-rw-r--r--usr/src/lib/libc/port/i18n/gettext_util.c12
-rw-r--r--usr/src/lib/libc/port/i18n/plural_parser.c64
-rw-r--r--usr/src/lib/libc/port/i18n/wscat.c6
-rw-r--r--usr/src/lib/libc/port/i18n/wscpy.c6
-rw-r--r--usr/src/lib/libc/port/i18n/wsncat.c6
-rw-r--r--usr/src/lib/libc/port/regex/wordexp.c2
19 files changed, 149 insertions, 153 deletions
diff --git a/usr/src/lib/libc/amd64/unwind/call_frame_inst.c b/usr/src/lib/libc/amd64/unwind/call_frame_inst.c
index 3e23a5e25b..64e112743e 100644
--- a/usr/src/lib/libc/amd64/unwind/call_frame_inst.c
+++ b/usr/src/lib/libc/amd64/unwind/call_frame_inst.c
@@ -127,7 +127,7 @@ uint64_t interpret_ops(void *data, void *data_end,
*/
void
_Unw_Propagate_Registers(struct _Unwind_Context *old_ctx,
- struct _Unwind_Context *new_ctx)
+ struct _Unwind_Context *new_ctx)
{
new_ctx->current_regs[SP_RSP] = old_ctx->cfa;
new_ctx->pc = old_ctx->ra;
@@ -228,7 +228,7 @@ fix_reg(struct _Unwind_Context *ctx, struct register_state *rs, int index)
*/
uint64_t
_Unw_Rollback_Registers(struct eh_frame_fields *f,
- struct _Unwind_Context *ctx)
+ struct _Unwind_Context *ctx)
{
/* GPRs, RET_ADD, and CF_ADDR */
struct register_state func_state[18];
@@ -361,7 +361,7 @@ static uint64_t get_encoded_val(void **datap, ptrdiff_t reloc, int enc);
*/
uint64_t
_Unw_get_val(void **datap, ptrdiff_t reloc,
- enum operand_desc opr, int daf, int caf, int enc)
+ enum operand_desc opr, int daf, int caf, int enc)
{
intptr_t data = (intptr_t)*datap;
uint64_t res;
@@ -453,7 +453,7 @@ _Unw_get_val(void **datap, ptrdiff_t reloc,
/* max length of augmentation string is 4 */
rp = (char *)&res;
dp = (char *)data;
- while (*rp++ = *dp++)
+ while ((*rp++ = *dp++) != '\0')
;
data = (intptr_t)dp;
break;
@@ -553,11 +553,11 @@ int interpret_op(void **datap, ptrdiff_t reloc,
uint64_t
interpret_ops(void *data, void *data_end,
- ptrdiff_t reloc,
- uint64_t start_pc, uint64_t pc,
- struct register_state f_state[],
- struct register_state f_start_state[],
- int daf, int caf, int enc)
+ ptrdiff_t reloc,
+ uint64_t start_pc, uint64_t pc,
+ struct register_state f_state[],
+ struct register_state f_start_state[],
+ int daf, int caf, int enc)
{
void *d = data;
uint64_t reached_pc = start_pc;
@@ -572,10 +572,10 @@ interpret_ops(void *data, void *data_end,
int
interpret_op(void **datap, ptrdiff_t reloc,
- uint64_t *reached_pc_p, uint64_t pc,
- struct register_state f_state[],
- struct register_state f_start_state[],
- int daf, int caf, int enc)
+ uint64_t *reached_pc_p, uint64_t pc,
+ struct register_state f_state[],
+ struct register_state f_start_state[],
+ int daf, int caf, int enc)
{
enum CFA_ops op = separate_op(datap);
enum operand_desc opr1 = (cfa_operations[op]).op1;
diff --git a/usr/src/lib/libc/port/gen/_xftw.c b/usr/src/lib/libc/port/gen/_xftw.c
index b6d32eebd4..eb16988600 100644
--- a/usr/src/lib/libc/port/gen/_xftw.c
+++ b/usr/src/lib/libc/port/gen/_xftw.c
@@ -200,7 +200,7 @@ fwalk(const char *path, int (*fn)(const char *, const struct stat *, int),
* We must ignore "." and "..", but other than that,
* just create a path name and call self to check it out.
*/
- while (direntp = readdir(dirp)) {
+ while ((direntp = readdir(dirp)) != NULL) {
long here;
if (strcmp(direntp->d_name, ".") == 0 ||
diff --git a/usr/src/lib/libc/port/gen/attrat.c b/usr/src/lib/libc/port/gen/attrat.c
index d7c7949175..279749c4e1 100644
--- a/usr/src/lib/libc/port/gen/attrat.c
+++ b/usr/src/lib/libc/port/gen/attrat.c
@@ -181,7 +181,7 @@ cgetattr(int fd, nvlist_t **response)
size_t nv_responselen;
struct stat buf;
- if (error = attrat_init())
+ if ((error = attrat_init()) != 0)
return (error);
if ((error = fstat(fd, &buf)) != 0)
return (error);
@@ -214,7 +214,7 @@ csetattr(int fd, nvlist_t *request)
void *nv_request;
size_t nv_requestlen;
- if (error = attrat_init())
+ if ((error = attrat_init()) != 0)
return (error);
if ((error = attr_nv_pack(request, &nv_request, &nv_requestlen)) != 0)
diff --git a/usr/src/lib/libc/port/gen/catopen.c b/usr/src/lib/libc/port/gen/catopen.c
index ece463fc2a..95c3e3f2ed 100644
--- a/usr/src/lib/libc/port/gen/catopen.c
+++ b/usr/src/lib/libc/port/gen/catopen.c
@@ -194,7 +194,7 @@ process_nls_path(char *name, int oflag)
s = _DFLT_LOC_PATH;
t = pathname;
- while (*t++ = *s++)
+ while ((*t++ = *s++) != '\0')
continue;
t--;
s = locale;
@@ -217,7 +217,7 @@ process_nls_path(char *name, int oflag)
*/
static char *
replace_nls_option(char *s, char *name, char *pathname, char *locale,
- char *lang, char *territory, char *codeset)
+ char *lang, char *territory, char *codeset)
{
char *t, *u;
diff --git a/usr/src/lib/libc/port/gen/ctime.c b/usr/src/lib/libc/port/gen/ctime.c
index c2a58b25b3..4f3b228598 100644
--- a/usr/src/lib/libc/port/gen/ctime.c
+++ b/usr/src/lib/libc/port/gen/ctime.c
@@ -25,9 +25,7 @@
*/
/* Copyright (c) 1988 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
+/* All Rights Reserved */
/*
* This routine converts time as follows.
@@ -117,7 +115,7 @@ __posix_asctime_r(const struct tm *t, char *cbuf)
int year = t->tm_year + 1900;
cp = cbuf;
- for (ncp = Date; *cp++ = *ncp++; /* */)
+ for (ncp = Date; (*cp++ = *ncp++) != '\0'; /* */)
;
ncp = Day + (3 * t->tm_wday);
cp = cbuf;
diff --git a/usr/src/lib/libc/port/gen/fmtmsg.c b/usr/src/lib/libc/port/gen/fmtmsg.c
index 063fe325f8..1bc51cf9aa 100644
--- a/usr/src/lib/libc/port/gen/fmtmsg.c
+++ b/usr/src/lib/libc/port/gen/fmtmsg.c
@@ -25,7 +25,7 @@
*/
/* Copyright (c) 1988 AT&T */
-/* All Rights Reserved */
+/* All Rights Reserved */
/*
* fmtmsg.c
@@ -251,9 +251,9 @@ static struct sevstr *penvsevs = (struct sevstr *)NULL;
static struct sevstr sevstrs[] = {
{ MM_HALT, "", SV_HALT, &sevstrs[1]},
- { MM_ERROR, "", SV_ERROR, &sevstrs[2]},
- { MM_WARNING, "", SV_WARN, &sevstrs[3]},
- { MM_INFO, "", SV_INF, (struct sevstr *)NULL},
+ { MM_ERROR, "", SV_ERROR, &sevstrs[2]},
+ { MM_WARNING, "", SV_WARN, &sevstrs[3]},
+ { MM_INFO, "", SV_INF, (struct sevstr *)NULL},
};
static struct sevstr *pstdsevs = &sevstrs[0];
@@ -359,7 +359,7 @@ noesc(char *str)
if (*p) {
q = p++;
- while (*q++ = *p++) {
+ while ((*q++ = *p++) != '\0') {
if (*p == '\\')
p++;
}
@@ -628,7 +628,7 @@ sevstrset(void)
/* Look for SEV_LEVEL definition */
- if ((value = getenv(SEV_LEVEL)) != (char *)NULL) {
+ if ((value = getenv(SEV_LEVEL)) != NULL) {
/* Allocate space and make a copy of the value of SEV_LEVEL */
if ((sevspace = libc_malloc(strlen(value) + 1)) != NULL) {
@@ -636,11 +636,11 @@ sevstrset(void)
/* Continue for all severity descriptions */
psev = getauxsevs(sevspace);
- plast = (struct sevstr *)NULL;
- if (psev != (struct sevstr *)NULL) {
+ plast = NULL;
+ if (psev != NULL) {
penvsevs = psev;
plast = psev;
- while (psev = getauxsevs((char *)NULL)) {
+ while ((psev = getauxsevs(NULL)) != NULL) {
plast->sevnext = psev;
plast = psev;
}
@@ -786,13 +786,13 @@ itoa(int n, char *s)
* Arguments:
* char *buf The buffer in which to format the message
* size_t size The size of the buffer
- * int verbosity A bit-string that indicates which components
+ * int verbosity A bit-string that indicates which components
* are to be written
- * const char *label The address of the label-component
- * int severity The severity value of the message
- * const char *text The address of the text-component
- * const char *action The address of the action-component
- * const char *tag The address of the tag-component
+ * const char *label The address of the label-component
+ * int severity The severity value of the message
+ * const char *text The address of the text-component
+ * const char *action The address of the action-component
+ * const char *tag The address of the tag-component
*
* This function formats the message consisting of the label-component,
* severity-component, text-component, action-component, and tag-
@@ -807,8 +807,8 @@ itoa(int n, char *s)
static void
writemsg(char *buf, size_t size,
- int verbosity, const char *label, int severity,
- const char *text, const char *action, const char *tag)
+ int verbosity, const char *label, int severity,
+ const char *text, const char *action, const char *tag)
{
struct sevstr *psev; /* Ptr for severity str list */
char *p; /* General purpose pointer */
@@ -1084,7 +1084,7 @@ writemsg(char *buf, size_t size,
int
fmtmsg(long class, const char *label, int severity,
-const char *text, const char *action, const char *tag)
+ const char *text, const char *action, const char *tag)
{
int rtnval; /* Value to return */
FILE *console; /* Ptr to "console" stream */
diff --git a/usr/src/lib/libc/port/gen/getut.c b/usr/src/lib/libc/port/gen/getut.c
index a622293d73..024eb76b53 100644
--- a/usr/src/lib/libc/port/gen/getut.c
+++ b/usr/src/lib/libc/port/gen/getut.c
@@ -25,7 +25,7 @@
*/
/* Copyright (c) 1988 AT&T */
-/* All Rights Reserved */
+/* All Rights Reserved */
/*
* Compatibility routines to read and write alternate
@@ -64,7 +64,7 @@
static void utmp_frec2api(const struct futmp *, struct utmp *);
static void utmp_api2frec(const struct utmp *, struct futmp *);
-struct utmp *_compat_getutent(void);
+struct utmp *_compat_getutent(void);
struct utmp *_compat_getutid(const struct utmp *);
struct utmp *_compat_getutline(const struct utmp *);
struct utmp *_compat_pututline(const struct utmp *);
@@ -553,7 +553,7 @@ _compat_modut(struct utmp *utp)
/* copy the supplied utmp structure someplace safe */
utmp = *utp;
_compat_setutent();
- while (fup = getutent_frec()) {
+ while ((fup = getutent_frec()) != NULL) {
if (idcmp(ucp->ut_id, fup->ut_id))
continue;
break;
diff --git a/usr/src/lib/libc/port/gen/getutx.c b/usr/src/lib/libc/port/gen/getutx.c
index 71b8364600..63decba9b7 100644
--- a/usr/src/lib/libc/port/gen/getutx.c
+++ b/usr/src/lib/libc/port/gen/getutx.c
@@ -925,7 +925,7 @@ modutx(const struct utmpx *utp)
*/
(void) memcpy(&utmp, utp, sizeof (utmp));
setutxent();
- while (fup = getutxent_frec()) {
+ while ((fup = getutxent_frec()) != NULL) {
if (idcmp(ucp->ut_id, fup->ut_id))
continue;
@@ -1166,7 +1166,7 @@ makeutx(const struct utmpx *utmp)
*/
(void) memset(saveid, falphanum, IDLEN);
- while (ut = getoneutx(&offset))
+ while ((ut = getoneutx(&offset)) != NULL)
if (idcmp(utmp->ut_id, ut->ut_id)) {
continue;
} else {
diff --git a/usr/src/lib/libc/port/gen/nftw.c b/usr/src/lib/libc/port/gen/nftw.c
index f07f9a9f94..a72e955991 100644
--- a/usr/src/lib/libc/port/gen/nftw.c
+++ b/usr/src/lib/libc/port/gen/nftw.c
@@ -364,7 +364,7 @@ walk(char *component,
this.inode = statb.st_ino;
oldbase = vp->state.base;
vp->state.base = (int)(component - vp->tmppath);
- while (dir = readdir(this.fd)) {
+ while ((dir = readdir(this.fd)) != NULL) {
if (dir->d_ino == 0)
continue;
q = dir->d_name;
diff --git a/usr/src/lib/libc/port/gen/nlspath_checks.c b/usr/src/lib/libc/port/gen/nlspath_checks.c
index f06b564cb0..986b34047e 100644
--- a/usr/src/lib/libc/port/gen/nlspath_checks.c
+++ b/usr/src/lib/libc/port/gen/nlspath_checks.c
@@ -229,7 +229,7 @@ nls_safe_open(const char *path, struct stat64 *statbuf, int *trust, int safe)
* allows one use, but we don't want to break existing functional code,
* even if it's buggy.
*/
-#define STORE(buf, size, arg, val) if (arg * FORMAT_SIZE + 1 >= size ||\
+#define STORE(buf, size, arg, val) if (arg * FORMAT_SIZE + 1 >= size ||\
(strict ? \
(buf[arg*FORMAT_SIZE] != '\0' && \
buf[arg*FORMAT_SIZE] != val) \
@@ -547,7 +547,8 @@ check_format(const char *org, const char *new, int strict)
nlen *= FORMAT_SIZE;
- for (n = nfmt; n = memchr(n, 'n', nfmt + nlen - n);
+ for (n = nfmt;
+ (n = memchr(n, 'n', nfmt + nlen - n)) != NULL;
n++) {
int off = (n - nfmt);
diff --git a/usr/src/lib/libc/port/gen/nsparse.c b/usr/src/lib/libc/port/gen/nsparse.c
index 57c07a7841..5e0301544d 100644
--- a/usr/src/lib/libc/port/gen/nsparse.c
+++ b/usr/src/lib/libc/port/gen/nsparse.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "lint.h"
#include "file64.h"
#include "mtlib.h"
@@ -48,7 +46,7 @@
#include <syslog.h>
-#define islabel(c) (isalnum(c) || (c) == '_')
+#define islabel(c) (isalnum(c) || (c) == '_')
#define LIBC_STRDUP(new, existing) \
if ((new = libc_strdup(existing)) == NULL) { \
@@ -112,7 +110,7 @@ static struct cons_cell *concell_list; /* stays with add_concell() */
* not explicitly set by the admin in the conf file, we want the old "resolver
* retry a few times" rather than no retries at all.
*/
-static int dns_tryagain_retry = 3;
+static int dns_tryagain_retry = 3;
/*
* For backward compat (pre "lookup control"), the dns default behavior is
@@ -129,11 +127,12 @@ set_dns_default_lkp(struct __nsw_lookup_v1 *lkp)
/*
* Private interface used by nss_common.c, hence this function is not static
+ *
+ * linep Nota Bene: not const char *
+ * errp Meanings are abused a bit
*/
struct __nsw_switchconfig_v1 *
_nsw_getoneconfig_v1(const char *name, char *linep, enum __nsw_parse_err *errp)
- /* linep Nota Bene: not const char * */
- /* errp Meanings are abused a bit */
{
struct __nsw_switchconfig_v1 *cfp;
struct __nsw_lookup_v1 *lkp, **lkq;
@@ -178,7 +177,8 @@ _nsw_getoneconfig_v1(const char *name, char *linep, enum __nsw_parse_err *errp)
lkp->actions[i] = __NSW_CONTINUE;
/* get criteria for the naming service */
- if (tokenp = skip(&linep, '[')) { /* got criteria */
+ tokenp = skip(&linep, '[');
+ if (tokenp != NULL) { /* got criteria */
/* premature end, illegal char following [ */
if (!islabel(*linep))
@@ -224,12 +224,11 @@ _nsw_getoneconfig_v1(const char *name, char *linep, enum __nsw_parse_err *errp)
if (strcasecmp(linep, __NSW_STR_RETURN) == 0)
act = __NSW_RETURN;
else if (strcasecmp(linep,
- __NSW_STR_CONTINUE) == 0) {
+ __NSW_STR_CONTINUE) == 0) {
if (strcasecmp(lkp->service_name,
- "dns") == 0 &&
- strcasecmp(tokenp,
- __NSW_STR_TRYAGAIN)
- == 0) {
+ "dns") == 0 &&
+ strcasecmp(tokenp,
+ __NSW_STR_TRYAGAIN) == 0) {
/*
* Add one more condition
* so it retries only if it's
@@ -240,7 +239,7 @@ _nsw_getoneconfig_v1(const char *name, char *linep, enum __nsw_parse_err *errp)
} else
act = __NSW_CONTINUE;
} else if (strcasecmp(linep,
- __NSW_STR_FOREVER) == 0)
+ __NSW_STR_FOREVER) == 0)
act = __NSW_TRYAGAIN_FOREVER;
else if (alldigits(linep)) {
act = __NSW_TRYAGAIN_NTIMES;
@@ -253,29 +252,29 @@ _nsw_getoneconfig_v1(const char *name, char *linep, enum __nsw_parse_err *errp)
if (__NSW_SUCCESS_ACTION(act) &&
strcasecmp(tokenp,
- __NSW_STR_SUCCESS) == 0) {
+ __NSW_STR_SUCCESS) == 0) {
lkp->actions[__NSW_SUCCESS] = act;
} else if (__NSW_NOTFOUND_ACTION(act) &&
- strcasecmp(tokenp,
- __NSW_STR_NOTFOUND) == 0) {
+ strcasecmp(tokenp,
+ __NSW_STR_NOTFOUND) == 0) {
lkp->actions[__NSW_NOTFOUND] = act;
} else if (__NSW_UNAVAIL_ACTION(act) &&
- strcasecmp(tokenp,
- __NSW_STR_UNAVAIL) == 0) {
+ strcasecmp(tokenp,
+ __NSW_STR_UNAVAIL) == 0) {
lkp->actions[__NSW_UNAVAIL] = act;
} else if (__NSW_TRYAGAIN_ACTION(act) &&
- strcasecmp(tokenp,
- __NSW_STR_TRYAGAIN) == 0) {
+ strcasecmp(tokenp,
+ __NSW_STR_TRYAGAIN) == 0) {
lkp->actions[__NSW_TRYAGAIN] = act;
if (strcasecmp(lkp->service_name,
- "nis") == 0)
+ "nis") == 0)
lkp->actions[
__NSW_NISSERVDNS_TRYAGAIN]
= act;
if (act == __NSW_TRYAGAIN_NTIMES)
lkp->max_retries =
- dns_continue ?
- dns_tryagain_retry : ntimes;
+ dns_continue ?
+ dns_tryagain_retry : ntimes;
} else {
/*EMPTY*/
/*
@@ -323,11 +322,12 @@ barf_line:
/*
* Private interface used by nss_common.c, hence this function is not static
+ *
+ * linep Nota Bene: not const char *
+ * errp Meanings are abused a bit
*/
struct __nsw_switchconfig *
_nsw_getoneconfig(const char *name, char *linep, enum __nsw_parse_err *errp)
- /* linep Nota Bene: not const char * */
- /* errp Meanings are abused a bit */
{
struct __nsw_switchconfig *cfp;
struct __nsw_lookup *lkp, **lkq;
@@ -370,7 +370,8 @@ _nsw_getoneconfig(const char *name, char *linep, enum __nsw_parse_err *errp)
lkp->actions[i] = 0;
/* get criteria for the naming service */
- if (tokenp = skip(&linep, '[')) { /* got criteria */
+ tokenp = skip(&linep, '[');
+ if (tokenp != NULL) { /* got criteria */
/* premature end, illegal char following [ */
if (!islabel(*linep))
@@ -410,10 +411,10 @@ _nsw_getoneconfig(const char *name, char *linep, enum __nsw_parse_err *errp)
if (strcasecmp(linep, __NSW_STR_RETURN) == 0)
act = __NSW_RETURN;
else if (strcasecmp(linep,
- __NSW_STR_CONTINUE) == 0)
+ __NSW_STR_CONTINUE) == 0)
act = __NSW_CONTINUE;
else if (strcasecmp(linep,
- __NSW_STR_FOREVER) == 0)
+ __NSW_STR_FOREVER) == 0)
/*
* =forever or =N might be in conf file
* but old progs won't expect it.
@@ -424,16 +425,16 @@ _nsw_getoneconfig(const char *name, char *linep, enum __nsw_parse_err *errp)
else
goto barf_line;
if (strcasecmp(tokenp,
- __NSW_STR_SUCCESS) == 0) {
+ __NSW_STR_SUCCESS) == 0) {
lkp->actions[__NSW_SUCCESS] = act;
} else if (strcasecmp(tokenp,
- __NSW_STR_NOTFOUND) == 0) {
+ __NSW_STR_NOTFOUND) == 0) {
lkp->actions[__NSW_NOTFOUND] = act;
} else if (strcasecmp(tokenp,
- __NSW_STR_UNAVAIL) == 0) {
+ __NSW_STR_UNAVAIL) == 0) {
lkp->actions[__NSW_UNAVAIL] = act;
} else if (strcasecmp(tokenp,
- __NSW_STR_TRYAGAIN) == 0) {
+ __NSW_STR_TRYAGAIN) == 0) {
lkp->actions[__NSW_TRYAGAIN] = act;
} else {
/*EMPTY*/
@@ -521,7 +522,8 @@ __nsw_getconfig_v1(const char *dbase, enum __nsw_parse_err *errp)
lmutex_lock(&serialize_config_v1);
top:
- if (cfp = scrounge_cache_v1(dbase)) {
+ cfp = scrounge_cache_v1(dbase);
+ if (cfp != NULL) {
*errp = __NSW_CONF_PARSE_SUCCESS;
lmutex_unlock(&serialize_config_v1);
if (fp != NULL)
@@ -545,7 +547,7 @@ top:
}
*errp = __NSW_CONF_PARSE_NOPOLICY;
- while (linep = fgets(lineq, BUFSIZ, fp)) {
+ while ((linep = fgets(lineq, BUFSIZ, fp)) != NULL) {
enum __nsw_parse_err line_err;
char *tokenp, *comment;
@@ -565,10 +567,12 @@ top:
if ((tokenp = skip(&linep, ':')) == NULL) {
continue; /* ignore this line */
}
- if (cfp = scrounge_cache_v1(tokenp)) {
+ cfp = scrounge_cache_v1(tokenp);
+ if (cfp != NULL) {
continue; /* ? somehow this database is in the cache */
}
- if (cfp = _nsw_getoneconfig_v1(tokenp, linep, &line_err)) {
+ cfp = _nsw_getoneconfig_v1(tokenp, linep, &line_err);
+ if (cfp != NULL) {
(void) add_concell_v1(cfp);
if (strcmp(cfp->dbase, dbase) == 0) {
*errp = __NSW_CONF_PARSE_SUCCESS;
@@ -619,7 +623,8 @@ __nsw_getconfig(const char *dbase, enum __nsw_parse_err *errp)
lmutex_lock(&serialize_config);
top:
- if (cfp = scrounge_cache(dbase)) {
+ cfp = scrounge_cache(dbase);
+ if (cfp != NULL) {
*errp = __NSW_CONF_PARSE_SUCCESS;
lmutex_unlock(&serialize_config);
if (fp != NULL)
@@ -642,7 +647,7 @@ top:
}
*errp = __NSW_CONF_PARSE_NOPOLICY;
- while (linep = fgets(lineq, BUFSIZ, fp)) {
+ while ((linep = fgets(lineq, BUFSIZ, fp)) != NULL) {
enum __nsw_parse_err line_err;
char *tokenp, *comment;
@@ -659,13 +664,16 @@ top:
if ((*linep == '\0') || isspace(*linep)) {
continue;
}
- if ((tokenp = skip(&linep, ':')) == NULL) {
+ tokenp = skip(&linep, ':');
+ if (tokenp == NULL) {
continue; /* ignore this line */
}
- if (cfp = scrounge_cache(tokenp)) {
+ cfp = scrounge_cache(tokenp);
+ if (cfp != NULL) {
continue; /* ? somehow this database is in the cache */
}
- if (cfp = _nsw_getoneconfig(tokenp, linep, &line_err)) {
+ cfp = _nsw_getoneconfig(tokenp, linep, &line_err);
+ if (cfp != NULL) {
(void) add_concell(cfp);
if (strcmp(cfp->dbase, dbase) == 0) {
*errp = __NSW_CONF_PARSE_SUCCESS;
diff --git a/usr/src/lib/libc/port/gen/rctlops.c b/usr/src/lib/libc/port/gen/rctlops.c
index c61eb8ec41..21e5133c18 100644
--- a/usr/src/lib/libc/port/gen/rctlops.c
+++ b/usr/src/lib/libc/port/gen/rctlops.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "lint.h"
#include <sys/rctl_impl.h>
#include <stdlib.h>
@@ -60,7 +58,8 @@ rctl_walk(int (*callback)(const char *rctlname, void *walk_data),
for (curr_name = ctl_names;
curr_name < ctl_names + sz;
curr_name += strlen(curr_name) + 1) {
- if (ret = callback(curr_name, init_data)) {
+ ret = callback(curr_name, init_data);
+ if (ret != 0) {
free(ctl_names);
return (ret);
}
diff --git a/usr/src/lib/libc/port/gen/regexpr.c b/usr/src/lib/libc/port/gen/regexpr.c
index efa3c2e0f0..90ced76497 100644
--- a/usr/src/lib/libc/port/gen/regexpr.c
+++ b/usr/src/lib/libc/port/gen/regexpr.c
@@ -25,9 +25,7 @@
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
+/* All Rights Reserved */
/*
* routines to do regular expression matching
@@ -294,7 +292,8 @@ re_exec(const char *p1)
do {
if (*p1 != c)
continue;
- if (rv = advance(p1, p2))
+ rv = advance(p1, p2);
+ if (rv != 0)
return (rv);
} while (*p1++);
return (0);
@@ -303,7 +302,8 @@ re_exec(const char *p1)
* regular algorithm
*/
do {
- if (rv = advance(p1, p2))
+ rv = advance(p1, p2);
+ if (rv != 0)
return (rv);
} while (*p1++);
return (0);
@@ -381,7 +381,8 @@ advance(const char *lp, char *ep)
while (backref(i, lp))
lp += ct;
while (lp >= curlp) {
- if (rv = advance(lp, ep))
+ rv = advance(lp, ep);
+ if (rv != 0)
return (rv);
lp -= ct;
}
@@ -411,7 +412,8 @@ advance(const char *lp, char *ep)
star:
do {
lp--;
- if (rv = advance(lp, ep))
+ rv = advance(lp, ep);
+ if (rv != 0)
return (rv);
} while (lp > curlp);
return (0);
diff --git a/usr/src/lib/libc/port/i18n/gettext_util.c b/usr/src/lib/libc/port/i18n/gettext_util.c
index 2898773e31..d11f71a80d 100644
--- a/usr/src/lib/libc/port/i18n/gettext_util.c
+++ b/usr/src/lib/libc/port/i18n/gettext_util.c
@@ -67,7 +67,7 @@ static const int category_name_len[] = {
*
* INPUT
* mp - uses the following members:
- * msgfile - buffer to store the pathname to the message file
+ * msgfile - buffer to store the pathname to the message file
* binding - directory pathname bound to specified domain
* cblen - length of binding
* locale - locale name
@@ -96,7 +96,7 @@ mk_msgfile(struct msg_pack *mp)
p = mp->msgfile;
q = mp->binding;
- while (*p = *q++)
+ while ((*p = *q++) != '\0')
p++;
cblen = (uint32_t)(p - mp->msgfile);
if (*(p - 1) != '/') {
@@ -126,17 +126,17 @@ mk_msgfile(struct msg_pack *mp)
return (NULL);
q = mp->locale;
- while (*p++ = *q++)
+ while ((*p++ = *q++) != '\0')
;
*(p - 1) = '/';
- while (*p++ = *catstr++)
+ while ((*p++ = *catstr++) != '\0')
;
*(p - 1) = '/';
q = mp->domain;
- while (*p = *q++)
+ while ((*p = *q++) != '\0')
p++;
q = MSGFILESUFFIX;
- while (*p++ = *q++)
+ while ((*p++ = *q++) != '\0')
;
#ifdef GETTEXT_DEBUG
diff --git a/usr/src/lib/libc/port/i18n/plural_parser.c b/usr/src/lib/libc/port/i18n/plural_parser.c
index 408d1b558d..4b4005ae86 100644
--- a/usr/src/lib/libc/port/i18n/plural_parser.c
+++ b/usr/src/lib/libc/port/i18n/plural_parser.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "lint.h"
#include <ctype.h>
#include <stdio.h>
@@ -108,8 +106,7 @@ stack_push(struct stack *stk, struct expr *exp)
}
static struct expr *
-stack_pop(struct stack *stk,
- struct expr *exp_a, struct expr *exp_b)
+stack_pop(struct stack *stk, struct expr *exp_a, struct expr *exp_b)
{
if (stk->index == 0) {
/* no item */
@@ -123,9 +120,9 @@ stack_pop(struct stack *stk,
#ifdef PARSE_DEBUG
printf("--- stack_pop ---\n");
printf(" type: %s\n",
- type_name[GETTYPE((stk->ptr[stk->index - 1])->op)]);
+ type_name[GETTYPE((stk->ptr[stk->index - 1])->op)]);
printf(" flag: %s\n",
- type_name[GETTYPE((stk->ptr[stk->index - 1])->flag)]);
+ type_name[GETTYPE((stk->ptr[stk->index - 1])->flag)]);
printf("-----------------\n");
#endif
return (stk->ptr[--stk->index]);
@@ -160,7 +157,7 @@ freeexpr(struct expr *e)
static struct expr *
setop1(unsigned int op, unsigned int num,
- struct stack *stk, unsigned int flag)
+ struct stack *stk, unsigned int flag)
{
struct expr *newitem;
unsigned int type;
@@ -187,7 +184,7 @@ setop1(unsigned int op, unsigned int num,
static struct expr *
setop_reduce(unsigned int n, unsigned int op, struct stack *stk,
- struct expr *exp1, struct expr *exp2, struct expr *exp3)
+ struct expr *exp1, struct expr *exp2, struct expr *exp3)
{
struct expr *newitem;
#ifdef PARSE_DEBUG
@@ -199,14 +196,11 @@ setop_reduce(unsigned int n, unsigned int op, struct stack *stk,
printf(" op type: %s\n", type_name[type]);
switch (n) {
case TRINARY:
- printf(" exp3 type: %s\n",
- type_name[GETTYPE(exp3->op)]);
+ printf(" exp3 type: %s\n", type_name[GETTYPE(exp3->op)]);
case BINARY:
- printf(" exp2 type: %s\n",
- type_name[GETTYPE(exp2->op)]);
+ printf(" exp2 type: %s\n", type_name[GETTYPE(exp2->op)]);
case UNARY:
- printf(" exp1 type: %s\n",
- type_name[GETTYPE(exp1->op)]);
+ printf(" exp1 type: %s\n", type_name[GETTYPE(exp1->op)]);
case NARY:
break;
}
@@ -464,8 +458,7 @@ plural_expr(struct expr **e, const char *plural_string)
stk = &stkbuf;
stk->index = 0;
- stk->ptr = (struct expr **)malloc(
- sizeof (struct expr *) * MAX_STACK_SIZE);
+ stk->ptr = malloc(sizeof (struct expr *) * MAX_STACK_SIZE);
if (!stk->ptr) {
/* malloc failed */
return (-1);
@@ -495,7 +488,7 @@ plural_expr(struct expr **e, const char *plural_string)
/* parse failed */
#ifdef PARSE_DEBUG
printf("ERR: T_EXP is not followed by %s\n",
- type_name[type]);
+ type_name[type]);
#endif
STACKFREE;
return (1);
@@ -516,7 +509,7 @@ plural_expr(struct expr **e, const char *plural_string)
/* parse failed */
#ifdef PARSE_DEBUG
printf("ERR: T_EXP is not followed by %s\n",
- type_name[type]);
+ type_name[type]);
#endif
STACKFREE;
return (1);
@@ -536,7 +529,7 @@ plural_expr(struct expr **e, const char *plural_string)
/* parse failed */
#ifdef PARSE_DEBUG
printf("ERR: T_EXP is not followed by %s\n",
- type_name[type]);
+ type_name[type]);
#endif
STACKFREE;
return (1);
@@ -557,7 +550,7 @@ plural_expr(struct expr **e, const char *plural_string)
/* parse failed */
#ifdef PARSE_DEBUG
printf("ERR: T_EXP is followed by %s\n",
- type_name[type]);
+ type_name[type]);
#endif
STACKFREE;
return (1);
@@ -578,7 +571,7 @@ plural_expr(struct expr **e, const char *plural_string)
/* parse failed */
#ifdef PARSE_DEBUG
printf("ERR: T_EXP is not followed by %s\n",
- type_name[type]);
+ type_name[type]);
#endif
STACKFREE;
return (1);
@@ -605,7 +598,7 @@ plural_expr(struct expr **e, const char *plural_string)
#ifdef PARSE_DEBUG
printf("=========== exp->flag: %s\n",
- type_name[ptype]);
+ type_name[ptype]);
#endif
if (ptype == T_LPAR) {
exp_op = stack_pop(stk, exp, NULL);
@@ -621,10 +614,10 @@ plural_expr(struct expr **e, const char *plural_string)
}
if ((popnum == BINARY) ||
- (ptype == T_LNOT) ||
- (ptype == T_CONDC)) {
+ (ptype == T_LNOT) ||
+ (ptype == T_CONDC)) {
result = reduce(&nexp, popnum,
- exp, stk);
+ exp, stk);
if (result)
return (result);
exp = nexp;
@@ -634,7 +627,7 @@ plural_expr(struct expr **e, const char *plural_string)
freeexpr(exp);
STACKFREE;
return (1);
- } /* for-loop */
+ } /* for-loop */
#ifdef PARSE_DEBUG
printf("========================= RPAR for loop out\n");
@@ -650,7 +643,7 @@ printf("========================= RPAR for loop out\n");
/* parse failed */
#ifdef PARSE_DEBUG
printf("ERR: T_EXP is followed by %s\n",
- type_name[type]);
+ type_name[type]);
#endif
STACKFREE;
return (1);
@@ -711,7 +704,7 @@ printf("========================== T_NUM/T_VAR for loop in\n");
fprio = GETPRIO(flag);
#ifdef PARSE_DEBUG
printf("========= flag: %s\n",
- type_name[ftype]);
+ type_name[ftype]);
#endif
if ((ftype == T_INIT) || (ftype == T_LPAR)) {
exp->flag = flag;
@@ -739,10 +732,10 @@ printf("========================== T_NUM/T_VAR for loop in\n");
* T_EQ, T_LAND, T_LOR
*/
if ((ntype == T_RPAR) ||
- (nprio <= fprio)) {
+ (nprio <= fprio)) {
/* reduce */
result = reduce(&nexp, BINARY,
- exp, stk);
+ exp, stk);
if (result)
return (result);
exp = nexp;
@@ -774,7 +767,7 @@ printf("========================== T_NUM/T_VAR for loop in\n");
if (nprio <= fprio) {
/* reduce */
result = reduce(&nexp, TRINARY,
- exp, stk);
+ exp, stk);
if (result)
return (result);
exp = nexp;
@@ -803,7 +796,7 @@ printf("======================= T_NUM/T_VAR for loop out\n");
/* parse failed */
STACKFREE;
return (1);
- } /* while-loop */
+ } /* while-loop */
if (GETTYPE(flag) != T_EXP) {
/* parse failed */
@@ -823,7 +816,7 @@ printf("======================= T_NUM/T_VAR for loop out\n");
#ifdef PARSE_DEBUG
printf("ERR: flag for the result is not T_INIT\n");
printf(" %s observed\n",
- type_name[GETTYPE(exp->flag)]);
+ type_name[GETTYPE(exp->flag)]);
#endif
freeexpr(exp);
STACKFREE;
@@ -834,7 +827,7 @@ printf("======================= T_NUM/T_VAR for loop out\n");
* exp still remains in stack.
* parse failed
*/
- while (nexp = stack_pop(stk, NULL, NULL))
+ while ((nexp = stack_pop(stk, NULL, NULL)) != NULL)
freeexpr(nexp);
freeexpr(exp);
return (1);
@@ -853,8 +846,7 @@ plural_eval(struct expr *exp, unsigned int n)
unsigned int e1, e2;
unsigned int type, opnum;
#ifdef GETTEXT_DEBUG
- (void) printf("*************** plural_eval(%p, %d)\n",
- exp, n);
+ (void) printf("*************** plural_eval(%p, %d)\n", exp, n);
printexpr(exp, 0);
#endif
diff --git a/usr/src/lib/libc/port/i18n/wscat.c b/usr/src/lib/libc/port/i18n/wscat.c
index eff4beb8a7..263ee6220d 100644
--- a/usr/src/lib/libc/port/i18n/wscat.c
+++ b/usr/src/lib/libc/port/i18n/wscat.c
@@ -25,9 +25,7 @@
*/
/* Copyright (c) 1986 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
+/* All Rights Reserved */
/*
* Concatenate s2 on the end of s1. S1's space must be large enough.
@@ -49,7 +47,7 @@ wcscat(wchar_t *s1, const wchar_t *s2)
while (*s1++) /* find end of s1 */
;
--s1;
- while (*s1++ = *s2++) /* copy s2 to s1 */
+ while ((*s1++ = *s2++) != 0) /* copy s2 to s1 */
;
return (os1);
}
diff --git a/usr/src/lib/libc/port/i18n/wscpy.c b/usr/src/lib/libc/port/i18n/wscpy.c
index 83c249ab22..a698ab9351 100644
--- a/usr/src/lib/libc/port/i18n/wscpy.c
+++ b/usr/src/lib/libc/port/i18n/wscpy.c
@@ -24,7 +24,7 @@
*/
/* Copyright (c) 1986 AT&T */
-/* All Rights Reserved */
+/* All Rights Reserved */
/*
* wcscpy(): copy string s2 to s1. S1 must be large enough.
@@ -46,7 +46,7 @@ wcscpy(wchar_t *s1, const wchar_t *s2)
{
wchar_t *os1 = s1;
- while (*s1++ = *s2++)
+ while ((*s1++ = *s2++) != 0)
continue;
return (os1);
}
@@ -60,7 +60,7 @@ wscpy(wchar_t *s1, const wchar_t *s2)
wchar_t *
wcpcpy(wchar_t *s1, const wchar_t *s2)
{
- while (*s1++ = *s2++)
+ while ((*s1++ = *s2++) != 0)
continue;
return (s1 - 1);
}
diff --git a/usr/src/lib/libc/port/i18n/wsncat.c b/usr/src/lib/libc/port/i18n/wsncat.c
index 6cb78abb07..edcffd7e4f 100644
--- a/usr/src/lib/libc/port/i18n/wsncat.c
+++ b/usr/src/lib/libc/port/i18n/wsncat.c
@@ -25,9 +25,7 @@
*/
/* Copyright (c) 1986 AT&T */
-/* All Rights Reserved */
-
-#pragma ident "%Z%%M% %I% %E% SMI"
+/* All Rights Reserved */
/*
* Concatenate s2 on the end of s1. S1's space must be large enough.
@@ -51,7 +49,7 @@ wcsncat(wchar_t *s1, const wchar_t *s2, size_t n)
;
++n;
--s1;
- while (*s1++ = *s2++) /* copy s2 to s1 */
+ while ((*s1++ = *s2++) != 0) /* copy s2 to s1 */
if (--n == 0) { /* at most n chars */
*--s1 = 0;
break;
diff --git a/usr/src/lib/libc/port/regex/wordexp.c b/usr/src/lib/libc/port/regex/wordexp.c
index 4c5fb8e5e0..6b34fb4a69 100644
--- a/usr/src/lib/libc/port/regex/wordexp.c
+++ b/usr/src/lib/libc/port/regex/wordexp.c
@@ -85,7 +85,7 @@ static int append(wordexp_t *, char *);
static char *
mystpcpy(char *s1, const char *s2)
{
- while (*s1++ = *s2++)
+ while ((*s1++ = *s2++) != '\0')
;
return (s1-1);
}