Date: Fri, 8 Dec 1995 05:21:07 -0500 (EST) From: "Marc G. Fournier" <scrappy@hub.org> To: FreeBSD-gnats-submit@freebsd.org Subject: misc/875: Cleaned code using -Wall to remove warnings Message-ID: <199512081021.FAA02413@hub.org> Resent-Message-ID: <199512081030.CAA19149@freefall.freebsd.org>
index | next in thread | raw e-mail
>Number: 875
>Category: misc
>Synopsis: Cleaned code using -Wall to remove warnings
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Fri Dec 8 02:30:03 PST 1995
>Last-Modified:
>Originator: Marc G. Fournier
>Organization:
>Release: FreeBSD 2.2-CURRENT
>Environment:
>Description:
Not a problem, really, just into spring cleaning of /usr/src/lib
hierachy using -Wall.
>How-To-Repeat:
>Fix:
*** lib/libc/db/btree/bt_open.c.orig Fri Dec 8 03:07:56 1995
--- lib/libc/db/btree/bt_open.c Fri Dec 8 03:10:50 1995
***************
*** 120,126 ****
*/
if (b.psize &&
(b.psize < MINPSIZE || b.psize > MAX_PAGE_OFFSET + 1 ||
! b.psize & sizeof(indx_t) - 1))
goto einval;
/* Minimum number of keys per page; absolute minimum is 2. */
--- 120,126 ----
*/
if (b.psize &&
(b.psize < MINPSIZE || b.psize > MAX_PAGE_OFFSET + 1 ||
! b.psize & (sizeof(indx_t) - 1)))
goto einval;
/* Minimum number of keys per page; absolute minimum is 2. */
***************
*** 242,248 ****
if (m.m_magic != BTREEMAGIC || m.m_version != BTREEVERSION)
goto eftype;
if (m.m_psize < MINPSIZE || m.m_psize > MAX_PAGE_OFFSET + 1 ||
! m.m_psize & sizeof(indx_t) - 1)
goto eftype;
if (m.m_flags & ~SAVEMETA)
goto eftype;
--- 242,248 ----
if (m.m_magic != BTREEMAGIC || m.m_version != BTREEVERSION)
goto eftype;
if (m.m_psize < MINPSIZE || m.m_psize > MAX_PAGE_OFFSET + 1 ||
! m.m_psize & (sizeof(indx_t) - 1))
goto eftype;
if (m.m_flags & ~SAVEMETA)
goto eftype;
***************
*** 275,282 ****
t->bt_psize = b.psize;
/* Set the cache size; must be a multiple of the page size. */
! if (b.cachesize && b.cachesize & b.psize - 1)
! b.cachesize += (~b.cachesize & b.psize - 1) + 1;
if (b.cachesize < b.psize * MINCACHE)
b.cachesize = b.psize * MINCACHE;
--- 275,282 ----
t->bt_psize = b.psize;
/* Set the cache size; must be a multiple of the page size. */
! if (b.cachesize && b.cachesize & (b.psize - 1))
! b.cachesize += (~b.cachesize & (b.psize - 1)) + 1;
if (b.cachesize < b.psize * MINCACHE)
b.cachesize = b.psize * MINCACHE;
*** lib/libc/db/recno/rec_open.c.orig Fri Dec 8 03:11:55 1995
--- lib/libc/db/recno/rec_open.c Fri Dec 8 03:17:41 1995
***************
*** 186,192 ****
if ((h = mpool_get(t->bt_mp, P_ROOT, 0)) == NULL)
goto err;
if ((h->flags & P_TYPE) == P_BLEAF) {
! h->flags = h->flags & ~P_TYPE | P_RLEAF;
mpool_put(t->bt_mp, h, MPOOL_DIRTY);
} else
mpool_put(t->bt_mp, h, 0);
--- 186,192 ----
if ((h = mpool_get(t->bt_mp, P_ROOT, 0)) == NULL)
goto err;
if ((h->flags & P_TYPE) == P_BLEAF) {
! h->flags = (h->flags & ~P_TYPE) | P_RLEAF;
mpool_put(t->bt_mp, h, MPOOL_DIRTY);
} else
mpool_put(t->bt_mp, h, 0);
*** lib/libc/gen/assert.c.orig Thu Dec 7 21:08:37 1995
--- lib/libc/gen/assert.c Thu Dec 7 21:26:36 1995
***************
*** 36,42 ****
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
! #include <assert.h>
#include <stdio.h>
#include <stdlib.h>
--- 36,42 ----
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
! /* #include <assert.h> */
#include <stdio.h>
#include <stdlib.h>
***************
*** 48,53 ****
(void)fprintf(stderr,
"assertion \"%s\" failed: file \"%s\", line %d\n",
failedexpr, file, line);
! abort();
/* NOTREACHED */
}
--- 48,53 ----
(void)fprintf(stderr,
"assertion \"%s\" failed: file \"%s\", line %d\n",
failedexpr, file, line);
! (void)abort();
/* NOTREACHED */
}
*** lib/libc/gen/err.c.orig Thu Dec 7 21:32:37 1995
--- lib/libc/gen/err.c Thu Dec 7 21:51:35 1995
***************
*** 91,97 ****
verr(eval, fmt, ap)
int eval;
const char *fmt;
! va_list ap;
{
int sverrno;
--- 91,97 ----
verr(eval, fmt, ap)
int eval;
const char *fmt;
! _BSD_VA_LIST_ ap;
{
int sverrno;
***************
*** 133,139 ****
verrx(eval, fmt, ap)
int eval;
const char *fmt;
! va_list ap;
{
if (! err_file)
err_set_file((FILE *)0);
--- 133,139 ----
verrx(eval, fmt, ap)
int eval;
const char *fmt;
! _BSD_VA_LIST_ ap;
{
if (! err_file)
err_set_file((FILE *)0);
***************
*** 168,174 ****
void
vwarn(fmt, ap)
const char *fmt;
! va_list ap;
{
int sverrno;
--- 168,174 ----
void
vwarn(fmt, ap)
const char *fmt;
! _BSD_VA_LIST_ ap;
{
int sverrno;
***************
*** 205,211 ****
void
vwarnx(fmt, ap)
const char *fmt;
! va_list ap;
{
if (! err_file)
err_set_file((FILE *)0);
--- 205,211 ----
void
vwarnx(fmt, ap)
const char *fmt;
! _BSD_VA_LIST_ ap;
{
if (! err_file)
err_set_file((FILE *)0);
*** lib/libc/gen/sysconf.c.orig Thu Dec 7 22:33:48 1995
--- lib/libc/gen/sysconf.c Thu Dec 7 22:33:55 1995
***************
*** 39,45 ****
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
! #include <sys/user.h>
#include <sys/sysctl.h>
#include <sys/resource.h>
--- 39,45 ----
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
! #include <sys/time.h>
#include <sys/sysctl.h>
#include <sys/resource.h>
*** lib/libc/gen/syslog.c.orig Fri Dec 8 04:48:49 1995
--- lib/libc/gen/syslog.c Fri Dec 8 04:54:20 1995
***************
*** 179,185 ****
if (LogTag != NULL)
(void)fprintf(fp, "%s", LogTag);
if (LogStat & LOG_PID)
! (void)fprintf(fp, "[%d]", getpid());
if (LogTag != NULL) {
(void)fprintf(fp, ": ");
}
--- 179,185 ----
if (LogTag != NULL)
(void)fprintf(fp, "%s", LogTag);
if (LogStat & LOG_PID)
! (void)fprintf(fp, "[%ld]", getpid());
if (LogTag != NULL) {
(void)fprintf(fp, ": ");
}
***************
*** 197,203 ****
}
/* Substitute error message for %m. */
! for ( ; ch = *fmt; ++fmt)
if (ch == '%' && fmt[1] == 'm') {
++fmt;
fputs(strerror(saved_errno), fmt_fp);
--- 197,203 ----
}
/* Substitute error message for %m. */
! for ( ; (ch = *fmt); ++fmt)
if (ch == '%' && fmt[1] == 'm') {
++fmt;
fputs(strerror(saved_errno), fmt_fp);
*** lib/libc/gen/rewinddir.c.orig Fri Dec 8 03:26:38 1995
--- lib/libc/gen/rewinddir.c Fri Dec 8 03:39:36 1995
***************
*** 38,43 ****
--- 38,45 ----
#include <sys/types.h>
#include <dirent.h>
+ void _seekdir(register DIR *, long);
+
void
rewinddir(dirp)
DIR *dirp;
*** lib/libc/gen/seekdir.c.orig Fri Dec 8 03:29:36 1995
--- lib/libc/gen/seekdir.c Fri Dec 8 03:40:03 1995
***************
*** 38,43 ****
--- 38,45 ----
#include <sys/param.h>
#include <dirent.h>
+ void _seekdir(register DIR *, long);
+
/*
* Seek to an entry in a directory.
* _seekdir is in telldir.c so that it can share opaque data structures.
*** lib/libc/gen/closedir.c.orig Fri Dec 8 03:35:49 1995
--- lib/libc/gen/closedir.c Fri Dec 8 03:38:48 1995
***************
*** 40,45 ****
--- 40,47 ----
#include <stdlib.h>
#include <unistd.h>
+ void _reclaim_telldir(register const DIR *);
+
/*
* close a directory.
*/
*** lib/libc/gen/fts.c.orig Fri Dec 8 03:41:41 1995
--- lib/libc/gen/fts.c Fri Dec 8 04:07:19 1995
***************
*** 56,62 ****
static FTSENT *fts_sort __P((FTS *, FTSENT *, int));
static u_short fts_stat __P((FTS *, FTSENT *, int));
! #define ISDOT(a) (a[0] == '.' && (!a[1] || a[1] == '.' && !a[2]))
#define ISSET(opt) (sp->fts_options & opt)
#define SET(opt) (sp->fts_options |= opt)
--- 56,62 ----
static FTSENT *fts_sort __P((FTS *, FTSENT *, int));
static u_short fts_stat __P((FTS *, FTSENT *, int));
! #define ISDOT(a) (a[0] == '.' && (!a[1] || (a[1] == '.' && !a[2])))
#define ISSET(opt) (sp->fts_options & opt)
#define SET(opt) (sp->fts_options |= opt)
***************
*** 304,310 ****
if (p->fts_info == FTS_D) {
/* If skipped or crossed mount point, do post-order visit. */
if (instr == FTS_SKIP ||
! ISSET(FTS_XDEV) && p->fts_dev != sp->fts_dev) {
if (p->fts_flags & FTS_SYMFOLLOW)
(void)close(p->fts_symfd);
if (sp->fts_child) {
--- 304,310 ----
if (p->fts_info == FTS_D) {
/* If skipped or crossed mount point, do post-order visit. */
if (instr == FTS_SKIP ||
! (ISSET(FTS_XDEV) && p->fts_dev != sp->fts_dev)) {
if (p->fts_flags & FTS_SYMFOLLOW)
(void)close(p->fts_symfd);
if (sp->fts_child) {
***************
*** 354,360 ****
/* Move to the next node on this level. */
next: tmp = p;
! if (p = p->fts_link) {
free(tmp);
/*
--- 354,360 ----
/* Move to the next node on this level. */
next: tmp = p;
! if ((p = p->fts_link)) {
free(tmp);
/*
***************
*** 640,646 ****
/* Read the directory, attaching each entry to the `link' pointer. */
adjaddr = NULL;
! for (head = tail = NULL, nitems = 0; dp = readdir(dirp);) {
if (!ISSET(FTS_SEEDOT) && ISDOT(dp->d_name))
continue;
--- 640,646 ----
/* Read the directory, attaching each entry to the `link' pointer. */
adjaddr = NULL;
! for (head = tail = NULL, nitems = 0; (dp = readdir(dirp));) {
if (!ISSET(FTS_SEEDOT) && ISDOT(dp->d_name))
continue;
***************
*** 680,687 ****
p->fts_accpath = cur->fts_accpath;
} else if (nlinks == 0
#ifdef DT_DIR
! || nlinks > 0 &&
! dp->d_type != DT_DIR && dp->d_type != DT_UNKNOWN
#endif
) {
p->fts_accpath =
--- 680,687 ----
p->fts_accpath = cur->fts_accpath;
} else if (nlinks == 0
#ifdef DT_DIR
! || ((nlinks > 0 &&
! dp->d_type != DT_DIR) && dp->d_type != DT_UNKNOWN)
#endif
) {
p->fts_accpath =
***************
*** 909,915 ****
register FTSENT *p;
/* Free a linked list of structures. */
! while (p = head) {
head = head->fts_link;
free(p);
}
--- 909,915 ----
register FTSENT *p;
/* Free a linked list of structures. */
! while ((p = head)) {
head = head->fts_link;
free(p);
}
*** lib/libc/gen/getcwd.c.orig Fri Dec 8 03:59:17 1995
--- lib/libc/gen/getcwd.c Fri Dec 8 04:01:21 1995
***************
*** 47,53 ****
#define ISDOT(dp) \
(dp->d_name[0] == '.' && (dp->d_name[1] == '\0' || \
! dp->d_name[1] == '.' && dp->d_name[2] == '\0'))
char *
getcwd(pt, size)
--- 47,53 ----
#define ISDOT(dp) \
(dp->d_name[0] == '.' && (dp->d_name[1] == '\0' || \
! (dp->d_name[1] == '.' && dp->d_name[2] == '\0')))
char *
getcwd(pt, size)
*** lib/libc/gen/siginterrupt.c.orig Fri Dec 8 04:09:08 1995
--- lib/libc/gen/siginterrupt.c Fri Dec 8 04:11:40 1995
***************
*** 41,46 ****
--- 41,47 ----
* Set signal state to prevent restart of system calls
* after an instance of the indicated signal.
*/
+ int
siginterrupt(sig, flag)
int sig, flag;
{
*** lib/libc/gen/sigsetops.c.orig Fri Dec 8 04:12:02 1995
--- lib/libc/gen/sigsetops.c Fri Dec 8 04:13:20 1995
***************
*** 45,50 ****
--- 45,51 ----
#undef sigdelset
#undef sigismember
+ int
sigemptyset(set)
sigset_t *set;
{
***************
*** 52,57 ****
--- 53,59 ----
return (0);
}
+ int
sigfillset(set)
sigset_t *set;
{
***************
*** 59,64 ****
--- 61,67 ----
return (0);
}
+ int
sigaddset(set, signo)
sigset_t *set;
int signo;
***************
*** 67,72 ****
--- 70,76 ----
return (0);
}
+ int
sigdelset(set, signo)
sigset_t *set;
int signo;
***************
*** 75,80 ****
--- 79,85 ----
return (0);
}
+ int
sigismember(set, signo)
const sigset_t *set;
int signo;
*** lib/libc/gen/timezone.c.orig Fri Dec 8 04:55:56 1995
--- lib/libc/gen/timezone.c Fri Dec 8 04:57:19 1995
***************
*** 62,69 ****
register char *beg,
*end;
! if (beg = getenv("TZNAME")) { /* set in environment */
! if (end = index(beg, ',')) { /* "PST,PDT" */
if (dst)
return(++end);
*end = '\0';
--- 62,69 ----
register char *beg,
*end;
! if ((beg = getenv("TZNAME"))) { /* set in environment */
! if ((end = index(beg, ','))) { /* "PST,PDT" */
if (dst)
return(++end);
*end = '\0';
*** lib/libc/gen/ttyname.c.orig Fri Dec 8 04:58:59 1995
--- lib/libc/gen/ttyname.c Fri Dec 8 04:59:27 1995
***************
*** 67,73 ****
if (fstat(fd, &sb) || !S_ISCHR(sb.st_mode))
return (NULL);
! if (db = dbopen(_PATH_DEVDB, O_RDONLY, 0, DB_HASH, NULL)) {
memset(&bkey, 0, sizeof(bkey));
bkey.type = S_IFCHR;
bkey.dev = sb.st_rdev;
--- 67,73 ----
if (fstat(fd, &sb) || !S_ISCHR(sb.st_mode))
return (NULL);
! if ((db = dbopen(_PATH_DEVDB, O_RDONLY, 0, DB_HASH, NULL))) {
memset(&bkey, 0, sizeof(bkey));
bkey.type = S_IFCHR;
bkey.dev = sb.st_rdev;
***************
*** 96,102 ****
if ((dp = opendir(_PATH_DEV)) == NULL)
return (NULL);
! while (dirp = readdir(dp)) {
if (dirp->d_fileno != sb->st_ino)
continue;
bcopy(dirp->d_name, buf + sizeof(_PATH_DEV) - 1,
--- 96,102 ----
if ((dp = opendir(_PATH_DEV)) == NULL)
return (NULL);
! while ((dirp = readdir(dp))) {
if (dirp->d_fileno != sb->st_ino)
continue;
bcopy(dirp->d_name, buf + sizeof(_PATH_DEV) - 1,
*** lib/libc/gen/ttyslot.c.orig Fri Dec 8 05:00:45 1995
--- lib/libc/gen/ttyslot.c Fri Dec 8 05:01:13 1995
***************
*** 51,62 ****
setttyent();
for (cnt = 0; cnt < 3; ++cnt)
! if (name = ttyname(cnt)) {
! if (p = rindex(name, '/'))
++p;
else
p = name;
! for (slot = 1; ttyp = getttyent(); ++slot)
if (!strcmp(ttyp->ty_name, p)) {
endttyent();
return(slot);
--- 51,62 ----
setttyent();
for (cnt = 0; cnt < 3; ++cnt)
! if ((name = ttyname(cnt))) {
! if ((p = rindex(name, '/')))
++p;
else
p = name;
! for (slot = 1; (ttyp = getttyent()); ++slot)
if (!strcmp(ttyp->ty_name, p)) {
endttyent();
return(slot);
*** lib/libc/gen/unvis.c.orig Fri Dec 8 05:02:26 1995
--- lib/libc/gen/unvis.c Fri Dec 8 05:02:37 1995
***************
*** 224,230 ****
char *start = dst;
int state = 0;
! while (c = *src++) {
again:
switch (unvis(dst, c, &state, 0)) {
case UNVIS_VALID:
--- 224,230 ----
char *start = dst;
int state = 0;
! while ((c = *src++)) {
again:
switch (unvis(dst, c, &state, 0)) {
case UNVIS_VALID:
*** lib/libc/gen/vis.c.orig Fri Dec 8 05:04:03 1995
--- lib/libc/gen/vis.c Fri Dec 8 05:04:18 1995
***************
*** 158,164 ****
register char c;
char *start;
! for (start = dst; c = *src;)
dst = vis(dst, c, flag, *++src);
*dst = '\0';
return (dst - start);
--- 158,164 ----
register char c;
char *start;
! for (start = dst; (c = *src);)
dst = vis(dst, c, flag, *++src);
*dst = '\0';
return (dst - start);
*** lib/libc/i386/gen/isinf.c.orig Fri Dec 8 05:07:05 1995
--- lib/libc/i386/gen/isinf.c Fri Dec 8 05:07:49 1995
***************
*** 39,44 ****
--- 39,45 ----
#include <sys/types.h>
+ int
isnan(d)
double d;
{
***************
*** 52,57 ****
--- 53,59 ----
return(p->exp == 2047 && (p->manh || p->manl));
}
+ int
isinf(d)
double d;
{
*** lib/libc/stdio/vfprintf.c.orig Fri Dec 8 01:46:12 1995
--- lib/libc/stdio/vfprintf.c Fri Dec 8 01:46:46 1995
***************
*** 278,284 ****
vfprintf(fp, fmt0, ap)
FILE *fp;
const char *fmt0;
! va_list ap;
{
register char *fmt; /* format string */
register int ch; /* character from fmt */
--- 278,284 ----
vfprintf(fp, fmt0, ap)
FILE *fp;
const char *fmt0;
! _BSD_VA_LIST_ ap;
{
register char *fmt; /* format string */
register int ch; /* character from fmt */
*** lib/libc/stdio/vfscanf.c.orig Fri Dec 8 01:50:42 1995
--- lib/libc/stdio/vfscanf.c Fri Dec 8 01:50:57 1995
***************
*** 97,103 ****
__svfscanf(fp, fmt0, ap)
register FILE *fp;
char const *fmt0;
! va_list ap;
{
register u_char *fmt = (u_char *)fmt0;
register int c; /* character from format, or conversion */
--- 97,103 ----
__svfscanf(fp, fmt0, ap)
register FILE *fp;
char const *fmt0;
! _BSD_VA_LIST_ ap;
{
register u_char *fmt = (u_char *)fmt0;
register int c; /* character from format, or conversion */
>Audit-Trail:
>Unformatted:
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199512081021.FAA02413>
