Module Name: src Committed By: rillig Date: Thu Mar 11 22:28:30 UTC 2021
Modified Files: src/usr.bin/indent: indent.c lexi.c pr_comment.c Log Message: indent: remove redundant cast after allocation functions No functional change. To generate a diff of this commit: cvs rdiff -u -r1.41 -r1.42 src/usr.bin/indent/indent.c cvs rdiff -u -r1.33 -r1.34 src/usr.bin/indent/lexi.c cvs rdiff -u -r1.16 -r1.17 src/usr.bin/indent/pr_comment.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/indent/indent.c diff -u src/usr.bin/indent/indent.c:1.41 src/usr.bin/indent/indent.c:1.42 --- src/usr.bin/indent/indent.c:1.41 Tue Mar 9 19:46:28 2021 +++ src/usr.bin/indent/indent.c Thu Mar 11 22:28:30 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: indent.c,v 1.41 2021/03/09 19:46:28 rillig Exp $ */ +/* $NetBSD: indent.c,v 1.42 2021/03/11 22:28:30 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -46,7 +46,7 @@ static char sccsid[] = "@(#)indent.c 5.1 #include <sys/cdefs.h> #ifndef lint #if defined(__NetBSD__) -__RCSID("$NetBSD: indent.c,v 1.41 2021/03/09 19:46:28 rillig Exp $"); +__RCSID("$NetBSD: indent.c,v 1.42 2021/03/11 22:28:30 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $"); #endif @@ -139,7 +139,7 @@ check_size_code(size_t desired_size) if (e_code + (desired_size) >= l_code) { int nsize = l_code - s_code + 400 + desired_size; int code_len = e_code - s_code; - codebuf = (char *)realloc(codebuf, nsize); + codebuf = realloc(codebuf, nsize); if (codebuf == NULL) err(1, NULL); e_code = codebuf + code_len + 1; @@ -154,7 +154,7 @@ check_size_label(size_t desired_size) if (e_lab + (desired_size) >= l_lab) { int nsize = l_lab - s_lab + 400 + desired_size; int label_len = e_lab - s_lab; - labbuf = (char *)realloc(labbuf, nsize); + labbuf = realloc(labbuf, nsize); if (labbuf == NULL) err(1, NULL); e_lab = labbuf + label_len + 1; @@ -397,16 +397,16 @@ main(int argc, char **argv) ps.last_nl = true; /* this is true if the last thing scanned was * a newline */ ps.last_token = semicolon; - combuf = (char *) malloc(bufsize); + combuf = malloc(bufsize); if (combuf == NULL) err(1, NULL); - labbuf = (char *) malloc(bufsize); + labbuf = malloc(bufsize); if (labbuf == NULL) err(1, NULL); - codebuf = (char *) malloc(bufsize); + codebuf = malloc(bufsize); if (codebuf == NULL) err(1, NULL); - tokenbuf = (char *) malloc(bufsize); + tokenbuf = malloc(bufsize); if (tokenbuf == NULL) err(1, NULL); alloc_typenames(); @@ -424,7 +424,7 @@ main(int argc, char **argv) s_com = e_com = combuf + 1; s_token = e_token = tokenbuf + 1; - in_buffer = (char *) malloc(10); + in_buffer = malloc(10); if (in_buffer == NULL) err(1, NULL); in_buffer_limit = in_buffer + 8; Index: src/usr.bin/indent/lexi.c diff -u src/usr.bin/indent/lexi.c:1.33 src/usr.bin/indent/lexi.c:1.34 --- src/usr.bin/indent/lexi.c:1.33 Thu Mar 11 22:15:44 2021 +++ src/usr.bin/indent/lexi.c Thu Mar 11 22:28:30 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: lexi.c,v 1.33 2021/03/11 22:15:44 rillig Exp $ */ +/* $NetBSD: lexi.c,v 1.34 2021/03/11 22:28:30 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -46,7 +46,7 @@ static char sccsid[] = "@(#)lexi.c 8.1 ( #include <sys/cdefs.h> #ifndef lint #if defined(__NetBSD__) -__RCSID("$NetBSD: lexi.c,v 1.33 2021/03/11 22:15:44 rillig Exp $"); +__RCSID("$NetBSD: lexi.c,v 1.34 2021/03/11 22:28:30 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/lexi.c 337862 2018-08-15 18:19:45Z pstef $"); #endif @@ -199,7 +199,7 @@ check_size_token(size_t desired_size) if (e_token + (desired_size) >= l_token) { int nsize = l_token - s_token + 400 + desired_size; int token_len = e_token - s_token; - tokenbuf = (char *)realloc(tokenbuf, nsize); + tokenbuf = realloc(tokenbuf, nsize); if (tokenbuf == NULL) err(1, NULL); e_token = tokenbuf + token_len + 1; @@ -690,7 +690,7 @@ void alloc_typenames(void) { - typenames = (const char **)malloc(sizeof(typenames[0]) * + typenames = malloc(sizeof(typenames[0]) * (typename_count = 16)); if (typenames == NULL) err(1, NULL); Index: src/usr.bin/indent/pr_comment.c diff -u src/usr.bin/indent/pr_comment.c:1.16 src/usr.bin/indent/pr_comment.c:1.17 --- src/usr.bin/indent/pr_comment.c:1.16 Thu Mar 11 22:15:44 2021 +++ src/usr.bin/indent/pr_comment.c Thu Mar 11 22:28:30 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pr_comment.c,v 1.16 2021/03/11 22:15:44 rillig Exp $ */ +/* $NetBSD: pr_comment.c,v 1.17 2021/03/11 22:28:30 rillig Exp $ */ /*- * SPDX-License-Identifier: BSD-4-Clause @@ -46,7 +46,7 @@ static char sccsid[] = "@(#)pr_comment.c #include <sys/cdefs.h> #ifndef lint #if defined(__NetBSD__) -__RCSID("$NetBSD: pr_comment.c,v 1.16 2021/03/11 22:15:44 rillig Exp $"); +__RCSID("$NetBSD: pr_comment.c,v 1.17 2021/03/11 22:28:30 rillig Exp $"); #elif defined(__FreeBSD__) __FBSDID("$FreeBSD: head/usr.bin/indent/pr_comment.c 334927 2018-06-10 16:44:18Z pstef $"); #endif @@ -70,7 +70,7 @@ check_size_comment(size_t desired_size, blank_pos = *last_bl_ptr - combuf; else blank_pos = -1; - combuf = (char *)realloc(combuf, nsize); + combuf = realloc(combuf, nsize); if (combuf == NULL) err(1, NULL); e_com = combuf + com_len + 1;