Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/config Use proper index types, delete casts, use cor...
details: https://anonhg.NetBSD.org/src/rev/e1b9e92eb17b
branches: trunk
changeset: 333910:e1b9e92eb17b
user: christos <christos%NetBSD.org@localhost>
date: Fri Nov 21 20:46:56 2014 +0000
description:
Use proper index types, delete casts, use correct sizeof() in allocations.
diffstat:
usr.bin/config/mkmakefile.c | 14 +++++++-------
usr.bin/config/sem.c | 6 +++---
usr.bin/config/sem.h | 4 ++--
3 files changed, 12 insertions(+), 12 deletions(-)
diffs (92 lines):
diff -r c2cde6fa7f8c -r e1b9e92eb17b usr.bin/config/mkmakefile.c
--- a/usr.bin/config/mkmakefile.c Fri Nov 21 20:21:08 2014 +0000
+++ b/usr.bin/config/mkmakefile.c Fri Nov 21 20:46:56 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mkmakefile.c,v 1.33 2014/11/17 00:53:15 uebayasi Exp $ */
+/* $NetBSD: mkmakefile.c,v 1.34 2014/11/21 20:46:56 christos Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
#endif
#include <sys/cdefs.h>
-__RCSID("$NetBSD: mkmakefile.c,v 1.33 2014/11/17 00:53:15 uebayasi Exp $");
+__RCSID("$NetBSD: mkmakefile.c,v 1.34 2014/11/21 20:46:56 christos Exp $");
#include <sys/param.h>
#include <ctype.h>
@@ -364,18 +364,18 @@
static int attrcmp(const void *l, const void *r);
struct attr **attrbuf;
-int attridx;
+size_t attridx;
static void
emitallkobjs(FILE *fp)
{
- int i;
+ size_t i;
- attrbuf = emalloc((size_t)nattrs * sizeof(attrbuf));
+ attrbuf = emalloc(nattrs * sizeof(*attrbuf));
ht_enumerate(attrtab, emitallkobjsweighcb, NULL);
ht_enumerate(attrtab, emitallkobjscb, NULL);
- qsort(attrbuf, (size_t)attridx, sizeof(struct attr *), attrcmp);
+ qsort(attrbuf, attridx, sizeof(struct attr *), attrcmp);
fputs("OBJS= \\\n", fp);
for (i = 0; i < attridx; i++)
@@ -398,7 +398,7 @@
/* XXX nattrs tracking is not exact yet */
if (attridx == nattrs) {
nattrs *= 2;
- attrbuf = erealloc(attrbuf, (size_t)nattrs * sizeof(attrbuf));
+ attrbuf = erealloc(attrbuf, nattrs * sizeof(*attrbuf));
}
return 0;
}
diff -r c2cde6fa7f8c -r e1b9e92eb17b usr.bin/config/sem.c
--- a/usr.bin/config/sem.c Fri Nov 21 20:21:08 2014 +0000
+++ b/usr.bin/config/sem.c Fri Nov 21 20:46:56 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sem.c,v 1.70 2014/11/15 08:21:38 uebayasi Exp $ */
+/* $NetBSD: sem.c,v 1.71 2014/11/21 20:46:56 christos Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
#endif
#include <sys/cdefs.h>
-__RCSID("$NetBSD: sem.c,v 1.70 2014/11/15 08:21:38 uebayasi Exp $");
+__RCSID("$NetBSD: sem.c,v 1.71 2014/11/21 20:46:56 christos Exp $");
#include <sys/param.h>
#include <ctype.h>
@@ -69,7 +69,7 @@
static struct hashtab *cfhashtab; /* for config lookup */
struct hashtab *devitab; /* etc */
struct attr allattr;
-int nattrs;
+size_t nattrs;
static struct attr errattr;
static struct devbase errdev;
diff -r c2cde6fa7f8c -r e1b9e92eb17b usr.bin/config/sem.h
--- a/usr.bin/config/sem.h Fri Nov 21 20:21:08 2014 +0000
+++ b/usr.bin/config/sem.h Fri Nov 21 20:46:56 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sem.h,v 1.18 2014/11/15 08:21:38 uebayasi Exp $ */
+/* $NetBSD: sem.h,v 1.19 2014/11/21 20:46:56 christos Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -88,4 +88,4 @@
extern const char *s_qmark;
extern const char *s_none;
extern const char *s_ifnet;
-extern int nattrs;
+extern size_t nattrs;
Home |
Main Index |
Thread Index |
Old Index