Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/stdio Remove a load of pointless casts - one that e...
details: https://anonhg.NetBSD.org/src/rev/fe81ae096b1b
branches: trunk
changeset: 748462:fe81ae096b1b
user: dsl <dsl%NetBSD.org@localhost>
date: Sat Oct 24 15:20:15 2009 +0000
description:
Remove a load of pointless casts - one that even lint doesn't bleat about.
diffstat:
lib/libc/stdio/asprintf.c | 8 ++++----
lib/libc/stdio/fgets.c | 10 +++++-----
lib/libc/stdio/fgetwc.c | 6 +++---
lib/libc/stdio/fread.c | 8 ++++----
lib/libc/stdio/fvwrite.c | 11 +++++------
lib/libc/stdio/getdelim.c | 8 ++++----
lib/libc/stdio/setbuffer.c | 8 ++++----
lib/libc/stdio/stdio.c | 8 ++++----
lib/libc/stdio/tempnam.c | 14 +++++++-------
lib/libc/stdio/ungetc.c | 10 +++++-----
lib/libc/stdio/vasprintf.c | 6 +++---
lib/libc/stdio/vfwprintf.c | 8 ++++----
lib/libc/stdio/vsnprintf_ss.c | 8 ++++----
13 files changed, 56 insertions(+), 57 deletions(-)
diffs (truncated from 480 to 300 lines):
diff -r ae505c828c16 -r fe81ae096b1b lib/libc/stdio/asprintf.c
--- a/lib/libc/stdio/asprintf.c Sat Oct 24 14:52:19 2009 +0000
+++ b/lib/libc/stdio/asprintf.c Sat Oct 24 15:20:15 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: asprintf.c,v 1.15 2007/01/26 00:27:54 cbiere Exp $ */
+/* $NetBSD: asprintf.c,v 1.16 2009/10/24 15:20:15 dsl Exp $ */
/*
* Copyright (c) 1997 Todd C. Miller <Todd.Miller%courtesan.com@localhost>
@@ -29,7 +29,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: asprintf.c,v 1.15 2007/01/26 00:27:54 cbiere Exp $");
+__RCSID("$NetBSD: asprintf.c,v 1.16 2009/10/24 15:20:15 dsl Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
@@ -60,7 +60,7 @@
_FILEEXT_SETUP(&f, &fext);
f._file = -1;
f._flags = __SWR | __SSTR | __SALC;
- f._bf._base = f._p = malloc((size_t)128);
+ f._bf._base = f._p = malloc(128);
if (f._bf._base == NULL)
goto err;
f._bf._size = f._w = 127; /* Leave room for the NUL */
@@ -70,7 +70,7 @@
if (ret < 0)
goto err;
*f._p = '\0';
- _base = realloc(f._bf._base, (size_t)ret + 1);
+ _base = realloc(f._bf._base, ret + 1);
if (_base == NULL)
goto err;
*str = (char *)_base;
diff -r ae505c828c16 -r fe81ae096b1b lib/libc/stdio/fgets.c
--- a/lib/libc/stdio/fgets.c Sat Oct 24 14:52:19 2009 +0000
+++ b/lib/libc/stdio/fgets.c Sat Oct 24 15:20:15 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fgets.c,v 1.24 2009/10/24 14:50:48 dsl Exp $ */
+/* $NetBSD: fgets.c,v 1.25 2009/10/24 15:20:15 dsl Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)fgets.c 8.2 (Berkeley) 12/22/93";
#else
-__RCSID("$NetBSD: fgets.c,v 1.24 2009/10/24 14:50:48 dsl Exp $");
+__RCSID("$NetBSD: fgets.c,v 1.25 2009/10/24 15:20:15 dsl Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -112,19 +112,19 @@
}
len = n;
}
- t = memchr((void *)p, '\n', len);
+ t = memchr(p, '\n', len);
if (t != NULL) {
len = (int)(++t - p);
fp->_r -= len;
fp->_p = t;
- (void)memcpy((void *)s, (void *)p, len);
+ (void)memcpy(s, p, len);
s[len] = 0;
FUNLOCKFILE(fp);
return (buf);
}
fp->_r -= len;
fp->_p += len;
- (void)memcpy((void *)s, (void *)p, len);
+ (void)memcpy(s, p, len);
s += len;
n -= len;
} while (n != 0);
diff -r ae505c828c16 -r fe81ae096b1b lib/libc/stdio/fgetwc.c
--- a/lib/libc/stdio/fgetwc.c Sat Oct 24 14:52:19 2009 +0000
+++ b/lib/libc/stdio/fgetwc.c Sat Oct 24 15:20:15 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fgetwc.c,v 1.8 2007/04/01 18:35:53 tnozaki Exp $ */
+/* $NetBSD: fgetwc.c,v 1.9 2009/10/24 15:20:15 dsl Exp $ */
/*-
* Copyright (c)2001 Citrus Project,
@@ -30,7 +30,7 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: fgetwc.c,v 1.8 2007/04/01 18:35:53 tnozaki Exp $");
+__RCSID("$NetBSD: fgetwc.c,v 1.9 2009/10/24 15:20:15 dsl Exp $");
#endif /* LIBC_SCCS and not lint */
#include <assert.h>
@@ -63,7 +63,7 @@
return WEOF;
}
nr = mbrtowc(&wc, (const char *)fp->_p,
- (size_t)fp->_r, &wcio->wcio_mbstate_in);
+ fp->_r, &wcio->wcio_mbstate_in);
if (nr == (size_t)-1) {
fp->_flags |= __SERR;
return WEOF;
diff -r ae505c828c16 -r fe81ae096b1b lib/libc/stdio/fread.c
--- a/lib/libc/stdio/fread.c Sat Oct 24 14:52:19 2009 +0000
+++ b/lib/libc/stdio/fread.c Sat Oct 24 15:20:15 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fread.c,v 1.17 2009/01/31 00:09:58 lukem Exp $ */
+/* $NetBSD: fread.c,v 1.18 2009/10/24 15:20:15 dsl Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)fread.c 8.2 (Berkeley) 12/11/93";
#else
-__RCSID("$NetBSD: fread.c,v 1.17 2009/01/31 00:09:58 lukem Exp $");
+__RCSID("$NetBSD: fread.c,v 1.18 2009/10/24 15:20:15 dsl Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -76,7 +76,7 @@
total = resid;
p = buf;
while (resid > (size_t)(r = fp->_r)) {
- (void)memcpy((void *)p, (void *)fp->_p, (size_t)r);
+ (void)memcpy(p, fp->_p, r);
fp->_p += r;
/* fp->_r = 0 ... done in __srefill */
p += r;
@@ -87,7 +87,7 @@
return ((total - resid) / size);
}
}
- (void)memcpy((void *)p, (void *)fp->_p, resid);
+ (void)memcpy(p, fp->_p, resid);
fp->_r -= resid;
fp->_p += resid;
FUNLOCKFILE(fp);
diff -r ae505c828c16 -r fe81ae096b1b lib/libc/stdio/fvwrite.c
--- a/lib/libc/stdio/fvwrite.c Sat Oct 24 14:52:19 2009 +0000
+++ b/lib/libc/stdio/fvwrite.c Sat Oct 24 15:20:15 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fvwrite.c,v 1.18 2009/02/11 23:48:17 lukem Exp $ */
+/* $NetBSD: fvwrite.c,v 1.19 2009/10/24 15:20:15 dsl Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)fvwrite.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: fvwrite.c,v 1.18 2009/02/11 23:48:17 lukem Exp $");
+__RCSID("$NetBSD: fvwrite.c,v 1.19 2009/10/24 15:20:15 dsl Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -84,7 +84,7 @@
}
#define MIN(a, b) ((a) < (b) ? (a) : (b))
-#define COPY(n) (void)memcpy((void *)fp->_p, (void *)p, (size_t)(n))
+#define COPY(n) (void)memcpy(fp->_p, p, (n))
iov = uio->uio_iov;
p = iov->iov_base;
@@ -135,8 +135,7 @@
do {
_size = (_size << 1) + 1;
} while (_size < blen + len);
- _base = realloc(fp->_bf._base,
- (size_t)(_size + 1));
+ _base = realloc(fp->_bf._base, _size + 1);
if (_base == NULL)
goto err;
fp->_w += _size - fp->_bf._size;
@@ -187,7 +186,7 @@
do {
GETIOV(nlknown = 0);
if (!nlknown) {
- nl = memchr((void *)p, '\n', (size_t)len);
+ nl = memchr(p, '\n', len);
nldist = nl ? nl + 1 - p : len + 1;
nlknown = 1;
}
diff -r ae505c828c16 -r fe81ae096b1b lib/libc/stdio/getdelim.c
--- a/lib/libc/stdio/getdelim.c Sat Oct 24 14:52:19 2009 +0000
+++ b/lib/libc/stdio/getdelim.c Sat Oct 24 15:20:15 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: getdelim.c,v 1.4 2009/09/24 20:38:53 roy Exp $ */
+/* $NetBSD: getdelim.c,v 1.5 2009/10/24 15:20:15 dsl Exp $ */
/*
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: getdelim.c,v 1.4 2009/09/24 20:38:53 roy Exp $");
+__RCSID("$NetBSD: getdelim.c,v 1.5 2009/10/24 15:20:15 dsl Exp $");
#include "namespace.h"
@@ -83,7 +83,7 @@
}
/* Scan through looking for the separator */
- p = memchr(fp->_p, sep, (size_t)fp->_r);
+ p = memchr(fp->_p, sep, fp->_r);
if (p == NULL)
len = fp->_r;
else
@@ -119,7 +119,7 @@
*buflen = newlen;
}
- (void)memcpy((void *)(*buf + off), (void *)fp->_p, len);
+ (void)memcpy(*buf + off, fp->_p, len);
/* Safe, len is never greater than what fp->_r can fit. */
fp->_r -= (int)len;
fp->_p += (int)len;
diff -r ae505c828c16 -r fe81ae096b1b lib/libc/stdio/setbuffer.c
--- a/lib/libc/stdio/setbuffer.c Sat Oct 24 14:52:19 2009 +0000
+++ b/lib/libc/stdio/setbuffer.c Sat Oct 24 15:20:15 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: setbuffer.c,v 1.10 2003/08/07 16:43:31 agc Exp $ */
+/* $NetBSD: setbuffer.c,v 1.11 2009/10/24 15:20:15 dsl Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)setbuffer.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: setbuffer.c,v 1.10 2003/08/07 16:43:31 agc Exp $");
+__RCSID("$NetBSD: setbuffer.c,v 1.11 2009/10/24 15:20:15 dsl Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -55,7 +55,7 @@
_DIAGASSERT(fp != NULL);
/* buf may be NULL */
- (void)setvbuf(fp, buf, buf ? _IOFBF : _IONBF, (size_t)size);
+ (void)setvbuf(fp, buf, buf ? _IOFBF : _IONBF, size);
}
/*
@@ -68,5 +68,5 @@
_DIAGASSERT(fp != NULL);
- return (setvbuf(fp, (char *)NULL, _IOLBF, (size_t)0));
+ return (setvbuf(fp, NULL, _IOLBF, 0));
}
diff -r ae505c828c16 -r fe81ae096b1b lib/libc/stdio/stdio.c
--- a/lib/libc/stdio/stdio.c Sat Oct 24 14:52:19 2009 +0000
+++ b/lib/libc/stdio/stdio.c Sat Oct 24 15:20:15 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: stdio.c,v 1.14 2008/03/13 15:40:00 christos Exp $ */
+/* $NetBSD: stdio.c,v 1.15 2009/10/24 15:20:15 dsl Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)stdio.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: stdio.c,v 1.14 2008/03/13 15:40:00 christos Exp $");
+__RCSID("$NetBSD: stdio.c,v 1.15 2009/10/24 15:20:15 dsl Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -68,7 +68,7 @@
_DIAGASSERT(fp != NULL);
_DIAGASSERT(buf != NULL);
- ret = read(__sfileno(fp), buf, (size_t)n);
+ ret = read(__sfileno(fp), buf, n);
/* if the read succeeded, update the current offset */
if (ret >= 0)
fp->_offset += ret;
@@ -91,7 +91,7 @@
if (fp->_flags & __SAPP)
(void) lseek(__sfileno(fp), (off_t)0, SEEK_END);
fp->_flags &= ~__SOFF; /* in case FAPPEND mode is set */
- return write(__sfileno(fp), buf, (size_t)n);
+ return write(__sfileno(fp), buf, n);
}
fpos_t
diff -r ae505c828c16 -r fe81ae096b1b lib/libc/stdio/tempnam.c
--- a/lib/libc/stdio/tempnam.c Sat Oct 24 14:52:19 2009 +0000
+++ b/lib/libc/stdio/tempnam.c Sat Oct 24 15:20:15 2009 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tempnam.c,v 1.19 2005/07/27 13:23:07 drochner Exp $ */
+/* $NetBSD: tempnam.c,v 1.20 2009/10/24 15:20:15 dsl Exp $ */
/*
Home |
Main Index |
Thread Index |
Old Index