All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH 3/7] pan/ltp-pan.c: remove unnecessary malloc type cast
@ 2015-06-15 13:23 Maninder Singh
  0 siblings, 0 replies; only message in thread
From: Maninder Singh @ 2015-06-15 13:23 UTC (permalink / raw
  To: ltp-list@lists.sourceforge.net

Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
Signed-off-by: Akhilesh Kumar <akhilesh.k@samsung.com>
---
 pan/ltp-pan.c |   20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/pan/ltp-pan.c b/pan/ltp-pan.c
index 905ff89..cee71aa 100644
--- a/pan/ltp-pan.c
+++ b/pan/ltp-pan.c
@@ -368,8 +368,8 @@ int main(int argc, char **argv)
 
 	/* a place to store the pgrps we're watching */
 	running =
-	    (struct tag_pgrp *)malloc((keep_active + 1) *
-				      sizeof(struct tag_pgrp));
+		malloc((keep_active + 1) *
+			sizeof(struct tag_pgrp));
 	if (running == NULL) {
 		fprintf(stderr, "pan(%s): Failed to allocate memory: %s\n",
 			panname, strerror(errno));
@@ -379,7 +379,7 @@ int main(int argc, char **argv)
 	running[keep_active].pgrp = -1;	/* end sentinel */
 
 	/* a head to the orphaned pgrp list */
-	orphans = (struct orphan_pgrp *)malloc(sizeof(struct orphan_pgrp));
+	orphans = malloc(sizeof(struct orphan_pgrp));
 	memset(orphans, 0, sizeof(struct orphan_pgrp));
 
 	srand48(time(NULL) ^ (getpid() + (getpid() << 15)));
@@ -1174,7 +1174,7 @@ static struct collection *get_collection(char *file, int optind, int argc,
 	if (!buf)
 		return NULL;
 
-	coll = (struct collection *)malloc(sizeof(struct collection));
+	coll = malloc(sizeof(struct collection));
 	coll->cnt = 0;
 
 	head = p = n = NULL;
@@ -1187,8 +1187,7 @@ static struct collection *get_collection(char *file, int optind, int argc,
 
 		/* If this is line isn't a comment */
 		if ((*a != '#') && (*a != '\0') && (*a != ' ')) {
-			n = (struct coll_entry *)
-			    malloc(sizeof(struct coll_entry));
+			n = malloc(sizeof(struct coll_entry));
 			if ((n->pcnt_f = strstr(a, "%f"))) {
 				n->pcnt_f[1] = 's';
 			}
@@ -1222,7 +1221,7 @@ static struct collection *get_collection(char *file, int optind, int argc,
 			workstr_left--;
 		}
 
-		n = (struct coll_entry *)malloc(sizeof(struct coll_entry));
+		n = malloc(sizeof(struct coll_entry));
 		if ((n->pcnt_f = strstr(workstr, "%f"))) {
 			n->pcnt_f[1] = 's';
 		}
@@ -1239,8 +1238,7 @@ static struct collection *get_collection(char *file, int optind, int argc,
 	}
 
 	/* get an array */
-	coll->ary = (struct coll_entry **)malloc(coll->cnt *
-						 sizeof(struct coll_entry *));
+	coll->ary = malloc(coll->cnt * sizeof(struct coll_entry *));
 
 	/* fill the array */
 	i = 0;
@@ -1275,7 +1273,7 @@ static char *slurp(char *file)
 		return NULL;
 	}
 
-	buf = (char *)malloc(sbuf.st_size + 1);
+	buf = malloc(sbuf.st_size + 1);
 	if (read(fd, buf, sbuf.st_size) != sbuf.st_size) {
 		fprintf(stderr, "pan(%s): slurp failed.  errno:%d  %s\n",
 			panname, errno, strerror(errno));
@@ -1328,7 +1326,7 @@ static void mark_orphan(struct orphan_pgrp *orphans, pid_t cpid)
 	}
 	if (orph == NULL) {
 		/* make a new struct */
-		orph = (struct orphan_pgrp *)malloc(sizeof(struct orphan_pgrp));
+		orph = malloc(sizeof(struct orphan_pgrp));
 
 		/* plug in the new struct just after the head */
 		orph->next = orphans->next;
-- 
1.7.9.5
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-06-15 13:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-15 13:23 [LTP] [PATCH 3/7] pan/ltp-pan.c: remove unnecessary malloc type cast Maninder Singh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.