Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libcurses remove bogus malloc casts
details: https://anonhg.NetBSD.org/src/rev/dd51e2086470
branches: trunk
changeset: 348528:dd51e2086470
user: christos <christos%NetBSD.org@localhost>
date: Sat Oct 22 21:55:06 2016 +0000
description:
remove bogus malloc casts
diffstat:
lib/libcurses/add_wchstr.c | 6 +++---
lib/libcurses/addbytes.c | 6 +++---
lib/libcurses/background.c | 8 ++++----
lib/libcurses/border.c | 21 +++++++++++----------
lib/libcurses/curses.c | 6 +++---
lib/libcurses/fileio.c | 8 ++++----
lib/libcurses/fileio.h | 2 +-
lib/libcurses/ins_wch.c | 6 +++---
lib/libcurses/ins_wstr.c | 6 +++---
9 files changed, 35 insertions(+), 34 deletions(-)
diffs (truncated from 309 to 300 lines):
diff -r f403b18dccb9 -r dd51e2086470 lib/libcurses/add_wchstr.c
--- a/lib/libcurses/add_wchstr.c Sat Oct 22 20:33:51 2016 +0000
+++ b/lib/libcurses/add_wchstr.c Sat Oct 22 21:55:06 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: add_wchstr.c,v 1.4 2010/02/23 19:48:26 drochner Exp $ */
+/* $NetBSD: add_wchstr.c,v 1.5 2016/10/22 21:55:06 christos Exp $ */
/*
* Copyright (c) 2005 The NetBSD Foundation Inc.
@@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: add_wchstr.c,v 1.4 2010/02/23 19:48:26 drochner Exp $");
+__RCSID("$NetBSD: add_wchstr.c,v 1.5 2016/10/22 21:55:06 christos Exp $");
#endif /* not lint */
#include <stdlib.h>
@@ -309,7 +309,7 @@
"wadd_wchnstr: as non-spacing char");
#endif /* DEBUG */
for (i = 0; i < chp->elements; i++) {
- np = (nschar_t *)malloc(sizeof(nschar_t));
+ np = malloc(sizeof(nschar_t));
if (!np)
return ERR;
np->ch = chp->vals[i];
diff -r f403b18dccb9 -r dd51e2086470 lib/libcurses/addbytes.c
--- a/lib/libcurses/addbytes.c Sat Oct 22 20:33:51 2016 +0000
+++ b/lib/libcurses/addbytes.c Sat Oct 22 21:55:06 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: addbytes.c,v 1.42 2013/11/10 03:14:16 christos Exp $ */
+/* $NetBSD: addbytes.c,v 1.43 2016/10/22 21:55:06 christos Exp $ */
/*
* Copyright (c) 1987, 1993, 1994
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)addbytes.c 8.4 (Berkeley) 5/4/94";
#else
-__RCSID("$NetBSD: addbytes.c,v 1.42 2013/11/10 03:14:16 christos Exp $");
+__RCSID("$NetBSD: addbytes.c,v 1.43 2016/10/22 21:55:06 christos Exp $");
#endif
#endif /* not lint */
@@ -537,7 +537,7 @@
if (wch->elements > 1) {
for (i = 1; i < wch->elements; i++) {
- np = (nschar_t *)malloc(sizeof(nschar_t));
+ np = malloc(sizeof(nschar_t));
if (!np)
return ERR;;
np->ch = wch->vals[i];
diff -r f403b18dccb9 -r dd51e2086470 lib/libcurses/background.c
--- a/lib/libcurses/background.c Sat Oct 22 20:33:51 2016 +0000
+++ b/lib/libcurses/background.c Sat Oct 22 21:55:06 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: background.c,v 1.15 2009/07/22 16:57:14 roy Exp $ */
+/* $NetBSD: background.c,v 1.16 2016/10/22 21:55:06 christos Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: background.c,v 1.15 2009/07/22 16:57:14 roy Exp $");
+__RCSID("$NetBSD: background.c,v 1.16 2016/10/22 21:55:06 christos Exp $");
#endif /* not lint */
#include <stdlib.h>
@@ -214,7 +214,7 @@
win->bch = wch->vals[ 0 ];
else {
if ( !np ) {
- np = (nschar_t *)malloc(sizeof(nschar_t));
+ np = malloc(sizeof(nschar_t));
if (!np)
return;
np->next = NULL;
@@ -228,7 +228,7 @@
if ( wch->elements > 1 ) {
for ( i = 1; i < wch->elements; i++ ) {
if ( !np ) {
- np = (nschar_t *)malloc(sizeof(nschar_t));
+ np = malloc(sizeof(nschar_t));
if (!np)
return;
np->next = NULL;
diff -r f403b18dccb9 -r dd51e2086470 lib/libcurses/border.c
--- a/lib/libcurses/border.c Sat Oct 22 20:33:51 2016 +0000
+++ b/lib/libcurses/border.c Sat Oct 22 21:55:06 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: border.c,v 1.15 2013/05/05 14:23:16 jdc Exp $ */
+/* $NetBSD: border.c,v 1.16 2016/10/22 21:55:06 christos Exp $ */
/*
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: border.c,v 1.15 2013/05/05 14:23:16 jdc Exp $");
+__RCSID("$NetBSD: border.c,v 1.16 2016/10/22 21:55:06 christos Exp $");
#endif /* not lint */
#include <stdlib.h>
@@ -319,7 +319,7 @@
SET_WCOL( win->alines[i]->line[j], cw );
if ( left.elements > 1 ) {
for (k = 1; k < left.elements; k++) {
- np = (nschar_t *)malloc(sizeof(nschar_t));
+ np = malloc(sizeof(nschar_t));
if (!np)
return ERR;
np->ch = left.vals[ k ];
@@ -362,7 +362,7 @@
SET_WCOL( win->alines[i]->line[j], cw );
if ( right.elements > 1 ) {
for (k = 1; k < right.elements; k++) {
- np = (nschar_t *)malloc(sizeof(nschar_t));
+ np = malloc(sizeof(nschar_t));
if (!np)
return ERR;
np->ch = right.vals[ k ];
@@ -428,7 +428,7 @@
SET_WCOL( win->alines[ 0 ]->line[ i + j ], cw );
if ( top.elements > 1 ) {
for ( k = 1; k < top.elements; k++ ) {
- np = (nschar_t *)malloc(sizeof(nschar_t));
+ np = malloc(sizeof(nschar_t));
if (!np)
return ERR;
np->ch = top.vals[ k ];
@@ -471,7 +471,8 @@
if ( bottom.elements > 1 ) {
for ( k = 1; k < bottom.elements;
k++ ) {
- if ( !( np = ( nschar_t *)malloc( sizeof( nschar_t ))))
+ np = malloc(sizeof(nschar_t));
+ if (!np)
return ERR;
np->ch = bottom.vals[ k ];
np->next = win->alines[endy]->line[i + j].nsp;
@@ -514,7 +515,7 @@
if ( topleft.elements > 1 ) {
for ( k = 1; k < topleft.elements;
k++ ) {
- np = (nschar_t *)malloc(sizeof(nschar_t));
+ np = malloc(sizeof(nschar_t));
if (!np)
return ERR;
np->ch = topleft.vals[ k ];
@@ -542,7 +543,7 @@
if ( topright.elements > 1 ) {
for ( k = 1; k < topright.elements;
k++ ) {
- np = (nschar_t *)malloc(sizeof(nschar_t));
+ np = malloc(sizeof(nschar_t));
if (!np)
return ERR;
np->ch = topright.vals[ k ];
@@ -574,7 +575,7 @@
if ( botleft.elements > 1 ) {
for ( k = 1; k < botleft.elements;
k++ ) {
- np = (nschar_t *)malloc(sizeof(nschar_t));
+ np = malloc(sizeof(nschar_t));
if (!np)
return ERR;
np->ch = botleft.vals[ k ];
@@ -602,7 +603,7 @@
brcw );
if ( botright.elements > 1 ) {
for ( k = 1; k < botright.elements; k++ ) {
- np = (nschar_t *)malloc(sizeof(nschar_t));
+ np = malloc(sizeof(nschar_t));
if (!np)
return ERR;
np->ch = botright.vals[ k ];
diff -r f403b18dccb9 -r dd51e2086470 lib/libcurses/curses.c
--- a/lib/libcurses/curses.c Sat Oct 22 20:33:51 2016 +0000
+++ b/lib/libcurses/curses.c Sat Oct 22 21:55:06 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: curses.c,v 1.25 2013/10/16 19:59:29 roy Exp $ */
+/* $NetBSD: curses.c,v 1.26 2016/10/22 21:55:06 christos Exp $ */
/*
* Copyright (c) 1981, 1993, 1994
@@ -35,7 +35,7 @@
#if 0
static char sccsid[] = "@(#)curses.c 8.3 (Berkeley) 5/4/94";
#else
-__RCSID("$NetBSD: curses.c,v 1.25 2013/10/16 19:59:29 roy Exp $");
+__RCSID("$NetBSD: curses.c,v 1.26 2016/10/22 21:55:06 christos Exp $");
#endif
#endif /* not lint */
@@ -95,7 +95,7 @@
pnp = tnp;
tnp = tnp->next;
} else {
- tnp = (nschar_t *)malloc(sizeof(nschar_t));
+ tnp = malloc(sizeof(nschar_t));
if (!tnp)
return ERR;
tnp->ch = np->ch;
diff -r f403b18dccb9 -r dd51e2086470 lib/libcurses/fileio.c
--- a/lib/libcurses/fileio.c Sat Oct 22 20:33:51 2016 +0000
+++ b/lib/libcurses/fileio.c Sat Oct 22 21:55:06 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fileio.c,v 1.4 2009/07/22 16:57:14 roy Exp $ */
+/* $NetBSD: fileio.c,v 1.5 2016/10/22 21:55:06 christos Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: fileio.c,v 1.4 2009/07/22 16:57:14 roy Exp $");
+__RCSID("$NetBSD: fileio.c,v 1.5 2016/10/22 21:55:06 christos Exp $");
#endif /* not lint */
#include "curses.h"
@@ -143,7 +143,7 @@
return ERR;
onsp = nsp;
while (n != 0) {
- tnsp = (nschar_t *)malloc(sizeof(nschar_t));
+ tnsp = malloc(sizeof(nschar_t));
if (tnsp == NULL) {
__cursesi_free_nsp(nsp);
return OK;
@@ -189,7 +189,7 @@
return NULL;
/* Window parameters */
- wtmp = (WINDOW *)malloc(sizeof(WINDOW));
+ wtmp = malloc(sizeof(WINDOW));
if (wtmp == NULL)
return NULL;
if (fread(wtmp, sizeof(WINDOW), 1, fp) != 1)
diff -r f403b18dccb9 -r dd51e2086470 lib/libcurses/fileio.h
--- a/lib/libcurses/fileio.h Sat Oct 22 20:33:51 2016 +0000
+++ b/lib/libcurses/fileio.h Sat Oct 22 21:55:06 2016 +0000
@@ -1,6 +1,6 @@
/*
* Do not edit! Automatically generated file:
- * from: NetBSD: shlib_version,v 1.40 2009/01/11 03:07:47 christos Exp
+ * from: NetBSD: shlib_version,v 1.41 2015/11/22 04:56:00 kamil Exp
* by : NetBSD: genfileioh.awk,v 1.2 2008/05/02 11:13:02 martin Exp
*/
diff -r f403b18dccb9 -r dd51e2086470 lib/libcurses/ins_wch.c
--- a/lib/libcurses/ins_wch.c Sat Oct 22 20:33:51 2016 +0000
+++ b/lib/libcurses/ins_wch.c Sat Oct 22 21:55:06 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ins_wch.c,v 1.6 2013/10/16 19:59:29 roy Exp $ */
+/* $NetBSD: ins_wch.c,v 1.7 2016/10/22 21:55:06 christos Exp $ */
/*
* Copyright (c) 2005 The NetBSD Foundation Inc.
@@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: ins_wch.c,v 1.6 2013/10/16 19:59:29 roy Exp $");
+__RCSID("$NetBSD: ins_wch.c,v 1.7 2016/10/22 21:55:06 christos Exp $");
#endif /* not lint */
#include <string.h>
@@ -213,7 +213,7 @@
SET_WCOL( *start, cw );
if ( wch->elements > 1 ) {
for ( i = 1; i < wch->elements; i++ ) {
- np = (nschar_t *)malloc(sizeof(nschar_t));
+ np = malloc(sizeof(nschar_t));
if (!np)
return ERR;
np->ch = wch->vals[ i ];
diff -r f403b18dccb9 -r dd51e2086470 lib/libcurses/ins_wstr.c
--- a/lib/libcurses/ins_wstr.c Sat Oct 22 20:33:51 2016 +0000
+++ b/lib/libcurses/ins_wstr.c Sat Oct 22 21:55:06 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ins_wstr.c,v 1.7 2013/10/16 19:59:29 roy Exp $ */
+/* $NetBSD: ins_wstr.c,v 1.8 2016/10/22 21:55:06 christos Exp $ */
/*
* Copyright (c) 2005 The NetBSD Foundation Inc.
@@ -36,7 +36,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: ins_wstr.c,v 1.7 2013/10/16 19:59:29 roy Exp $");
+__RCSID("$NetBSD: ins_wstr.c,v 1.8 2016/10/22 21:55:06 christos Exp $");
#endif /* not lint */
#include <string.h>
Home |
Main Index |
Thread Index |
Old Index