Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/indent indent: remove redundant cast after allocatio...



details:   https://anonhg.NetBSD.org/src/rev/7b912233b3f9
branches:  trunk
changeset: 1019481:7b912233b3f9
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Mar 11 22:28:30 2021 +0000

description:
indent: remove redundant cast after allocation functions

No functional change.

diffstat:

 usr.bin/indent/indent.c     |  18 +++++++++---------
 usr.bin/indent/lexi.c       |   8 ++++----
 usr.bin/indent/pr_comment.c |   6 +++---
 3 files changed, 16 insertions(+), 16 deletions(-)

diffs (129 lines):

diff -r 1b5569b0fa85 -r 7b912233b3f9 usr.bin/indent/indent.c
--- a/usr.bin/indent/indent.c   Thu Mar 11 22:15:44 2021 +0000
+++ b/usr.bin/indent/indent.c   Thu Mar 11 22:28:30 2021 +0000
@@ -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 @@
 #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 @@
     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 @@
     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 @@
     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 @@
     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;
diff -r 1b5569b0fa85 -r 7b912233b3f9 usr.bin/indent/lexi.c
--- a/usr.bin/indent/lexi.c     Thu Mar 11 22:15:44 2021 +0000
+++ b/usr.bin/indent/lexi.c     Thu Mar 11 22:28:30 2021 +0000
@@ -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 @@
 #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 @@
     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 @@
 alloc_typenames(void)
 {
 
-    typenames = (const char **)malloc(sizeof(typenames[0]) *
+    typenames = malloc(sizeof(typenames[0]) *
         (typename_count = 16));
     if (typenames == NULL)
        err(1, NULL);
diff -r 1b5569b0fa85 -r 7b912233b3f9 usr.bin/indent/pr_comment.c
--- a/usr.bin/indent/pr_comment.c       Thu Mar 11 22:15:44 2021 +0000
+++ b/usr.bin/indent/pr_comment.c       Thu Mar 11 22:28:30 2021 +0000
@@ -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 @@
 #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 @@
            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;



Home | Main Index | Thread Index | Old Index