diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2016-08-24 03:13:46 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2016-08-24 03:13:46 +0000 |
commit | 7f28b567a5534995a0d3365b1cf24d086e0284fb (patch) | |
tree | 6446b81b0d1876509652928269c8975f5a27b7c5 /usr.bin | |
parent | 23e5637fa89f1ae07867fbee688d160f216345f7 (diff) |
Convert quad_t to int64_t and %q to %ll
Convert bzero() to memset() and bcopy() to memcpy()
ok natano@ millert@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/du/du.c | 16 | ||||
-rw-r--r-- | usr.bin/hexdump/display.c | 18 | ||||
-rw-r--r-- | usr.bin/hexdump/parse.c | 18 | ||||
-rw-r--r-- | usr.bin/systat/vmstat.c | 18 |
4 files changed, 36 insertions, 34 deletions
diff --git a/usr.bin/du/du.c b/usr.bin/du/du.c index 95b409cbfb2..c26638257f5 100644 --- a/usr.bin/du/du.c +++ b/usr.bin/du/du.c @@ -1,4 +1,4 @@ -/* $OpenBSD: du.c,v 1.31 2015/10/10 05:32:52 deraadt Exp $ */ +/* $OpenBSD: du.c,v 1.32 2016/08/24 03:13:45 guenther Exp $ */ /* $NetBSD: du.c,v 1.11 1996/10/18 07:20:35 thorpej Exp $ */ /* @@ -50,7 +50,7 @@ int linkchk(FTSENT *); -void prtout(quad_t, char *, int); +void prtout(int64_t, char *, int); void usage(void); int @@ -59,7 +59,7 @@ main(int argc, char *argv[]) FTS *fts; FTSENT *p; long blocksize; - quad_t totalblocks; + int64_t totalblocks; int ftsoptions, listfiles, maxdepth; int Hflag, Lflag, cflag, hflag, kflag; int ch, notused, rval; @@ -177,7 +177,7 @@ main(int argc, char *argv[]) * root of a traversal, display the total. */ if (p->fts_level <= maxdepth) - prtout((quad_t)howmany(p->fts_number, + prtout(howmany(p->fts_number, (unsigned long)blocksize), p->fts_path, hflag); break; @@ -207,7 +207,7 @@ main(int argc, char *argv[]) if (errno) err(1, "fts_read"); if (cflag) { - prtout((quad_t)howmany(totalblocks, blocksize), "total", hflag); + prtout(howmany(totalblocks, blocksize), "total", hflag); } fts_close(fts); exit(rval); @@ -301,17 +301,17 @@ linkchk(FTSENT *p) } void -prtout(quad_t size, char *path, int hflag) +prtout(int64_t size, char *path, int hflag) { if (!hflag) - (void)printf("%lld\t%s\n", (long long)size, path); + (void)printf("%lld\t%s\n", size, path); else { char buf[FMT_SCALED_STRSIZE]; if (fmt_scaled(size * 512, buf) == 0) (void)printf("%s\t%s\n", buf, path); else - (void)printf("%lld\t%s\n", (long long)size, path); + (void)printf("%lld\t%s\n", size, path); } } diff --git a/usr.bin/hexdump/display.c b/usr.bin/hexdump/display.c index 88fed34f678..46962072d72 100644 --- a/usr.bin/hexdump/display.c +++ b/usr.bin/hexdump/display.c @@ -1,4 +1,4 @@ -/* $OpenBSD: display.c,v 1.24 2016/03/15 04:19:13 mmcc Exp $ */ +/* $OpenBSD: display.c,v 1.25 2016/08/24 03:13:45 guenther Exp $ */ /* $NetBSD: display.c,v 1.12 2001/12/07 15:14:29 bjh21 Exp $ */ /* @@ -100,7 +100,7 @@ display(void) for (pr = endfu->nextpr; pr; pr = pr->nextpr) switch(pr->flags) { case F_ADDRESS: - (void)printf(pr->fmt, (quad_t)eaddress); + (void)printf(pr->fmt, (int64_t)eaddress); break; case F_TEXT: (void)printf("%s", pr->fmt); @@ -123,7 +123,7 @@ print(PR *pr, u_char *bp) switch(pr->flags) { case F_ADDRESS: - (void)printf(pr->fmt, (quad_t)address); + (void)printf(pr->fmt, (int64_t)address); break; case F_BPAD: (void)printf(pr->fmt, ""); @@ -149,15 +149,15 @@ print(PR *pr, u_char *bp) case F_INT: switch(pr->bcnt) { case 1: - (void)printf(pr->fmt, (quad_t)*bp); + (void)printf(pr->fmt, (int64_t)*bp); break; case 2: memmove(&s2, bp, sizeof(s2)); - (void)printf(pr->fmt, (quad_t)s2); + (void)printf(pr->fmt, (int64_t)s2); break; case 4: memmove(&s4, bp, sizeof(s4)); - (void)printf(pr->fmt, (quad_t)s4); + (void)printf(pr->fmt, (int64_t)s4); break; case 8: memmove(&s8, bp, sizeof(s8)); @@ -180,15 +180,15 @@ print(PR *pr, u_char *bp) case F_UINT: switch(pr->bcnt) { case 1: - (void)printf(pr->fmt, (u_quad_t)*bp); + (void)printf(pr->fmt, (uint64_t)*bp); break; case 2: memmove(&u2, bp, sizeof(u2)); - (void)printf(pr->fmt, (u_quad_t)u2); + (void)printf(pr->fmt, (uint64_t)u2); break; case 4: memmove(&u4, bp, sizeof(u4)); - (void)printf(pr->fmt, (u_quad_t)u4); + (void)printf(pr->fmt, (uint64_t)u4); break; case 8: memmove(&u8, bp, sizeof(u8)); diff --git a/usr.bin/hexdump/parse.c b/usr.bin/hexdump/parse.c index 8d0a104e902..321769903a4 100644 --- a/usr.bin/hexdump/parse.c +++ b/usr.bin/hexdump/parse.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.c,v 1.20 2016/03/15 04:19:13 mmcc Exp $ */ +/* $OpenBSD: parse.c,v 1.21 2016/08/24 03:13:45 guenther Exp $ */ /* $NetBSD: parse.c,v 1.12 2001/12/07 13:37:39 bjh21 Exp $ */ /* @@ -217,7 +217,7 @@ rewrite(FS *fs) PR *pr, **nextpr; FU *fu; char *p1, *p2; - char savech, *fmtp, cs[3]; + char savech, *fmtp, cs[4]; int nconv, prec; size_t len; @@ -295,9 +295,10 @@ rewrite(FS *fs) else pr->flags = F_UINT; - cs[2] = '\0'; - cs[1] = cs[0]; - cs[0] = 'q'; + cs[3] = '\0'; + cs[2] = cs[0]; + cs[1] = 'l'; + cs[0] = 'l'; switch(fu->bcnt) { case 0: case 4: pr->bcnt = 4; @@ -355,9 +356,10 @@ rewrite(FS *fs) ++p2; switch(p1[2]) { case 'd': case 'o': case'x': - cs[0] = 'q'; - cs[1] = p1[2]; - cs[2] = '\0'; + cs[0] = 'l'; + cs[1] = 'l'; + cs[2] = p1[2]; + cs[3] = '\0'; break; default: if (p1[2]) diff --git a/usr.bin/systat/vmstat.c b/usr.bin/systat/vmstat.c index 4f53c0b9322..9410d4a339a 100644 --- a/usr.bin/systat/vmstat.c +++ b/usr.bin/systat/vmstat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vmstat.c,v 1.80 2015/08/20 22:32:42 deraadt Exp $ */ +/* $OpenBSD: vmstat.c,v 1.81 2016/08/24 03:13:45 guenther Exp $ */ /* $NetBSD: vmstat.c,v 1.5 1996/05/10 23:16:40 thorpej Exp $ */ /*- @@ -64,7 +64,7 @@ static struct Info { struct vmtotal Total; struct nchstats nchstats; long nchcount; - u_quad_t *intrcnt; + uint64_t *intrcnt; } s, s1, s2, s3, z; extern struct _disk cur; @@ -606,25 +606,25 @@ getinfo(struct Info *si) size = sizeof(si->time); if (sysctl(cp_time_mib, 2, &si->time, &size, NULL, 0) < 0) { error("Can't get KERN_CPTIME: %s\n", strerror(errno)); - bzero(&si->time, sizeof(si->time)); + memset(&si->time, 0, sizeof(si->time)); } size = sizeof(si->nchstats); if (sysctl(nchstats_mib, 2, &si->nchstats, &size, NULL, 0) < 0) { error("Can't get KERN_NCHSTATS: %s\n", strerror(errno)); - bzero(&si->nchstats, sizeof(si->nchstats)); + memset(&si->nchstats, 0, sizeof(si->nchstats)); } size = sizeof(si->uvmexp); if (sysctl(uvmexp_mib, 2, &si->uvmexp, &size, NULL, 0) < 0) { error("Can't get VM_UVMEXP: %s\n", strerror(errno)); - bzero(&si->uvmexp, sizeof(si->uvmexp)); + memset(&si->uvmexp, 0, sizeof(si->uvmexp)); } size = sizeof(si->Total); if (sysctl(vmtotal_mib, 2, &si->Total, &size, NULL, 0) < 0) { error("Can't get VM_METER: %s\n", strerror(errno)); - bzero(&si->Total, sizeof(si->Total)); + memset(&si->Total, 0, sizeof(si->Total)); } } @@ -632,7 +632,7 @@ static void allocinfo(struct Info *si) { memset(si, 0, sizeof(*si)); - si->intrcnt = calloc(nintr, sizeof(u_quad_t)); + si->intrcnt = calloc(nintr, sizeof(*si->intrcnt)); if (si->intrcnt == NULL) errx(2, "out of memory"); } @@ -640,11 +640,11 @@ allocinfo(struct Info *si) static void copyinfo(struct Info *from, struct Info *to) { - u_quad_t *intrcnt; + uint64_t *intrcnt; intrcnt = to->intrcnt; *to = *from; - bcopy(from->intrcnt, to->intrcnt = intrcnt, nintr * sizeof (u_quad_t)); + memcpy(to->intrcnt = intrcnt, from->intrcnt, nintr * sizeof(*intrcnt)); } static void |