mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 01/11] environment: drop unnecessary casts
Date: Thu,  6 Nov 2014 13:59:28 +0100	[thread overview]
Message-ID: <1415278778-20826-2-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1415278778-20826-1-git-send-email-s.hauer@pengutronix.de>

No Need to cast void pointers.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 common/environment.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/common/environment.c b/common/environment.c
index e55c7b7..db3fad2 100644
--- a/common/environment.c
+++ b/common/environment.c
@@ -106,14 +106,14 @@ static int file_save_action(const char *filename, struct stat *statbuf,
 	int fd;
 	int namelen = strlen(filename) + 1 - strlen(data->base);
 
-	inode = (struct envfs_inode*)data->writep;
+	inode = data->writep;
 	inode->magic = ENVFS_32(ENVFS_INODE_MAGIC);
 	inode->headerlen = ENVFS_32(PAD4(namelen + sizeof(struct envfs_inode_end)));
 	data->writep += sizeof(struct envfs_inode);
 
 	strcpy(data->writep, filename + strlen(data->base));
 	data->writep += PAD4(namelen);
-	inode_end = (struct envfs_inode_end*)data->writep;
+	inode_end = data->writep;
 	data->writep += sizeof(struct envfs_inode_end);
 	inode_end->magic = ENVFS_32(ENVFS_INODE_END_MAGIC);
 	inode_end->mode = ENVFS_32(S_IRWXU | S_IRWXG | S_IRWXO);
@@ -196,7 +196,7 @@ int envfs_save(const char *filename, const char *dirname, unsigned flags)
 	buf = xzalloc(size + sizeof(struct envfs_super));
 	data.writep = buf + sizeof(struct envfs_super);
 
-	super = (struct envfs_super *)buf;
+	super = buf;
 	super->magic = ENVFS_32(ENVFS_MAGIC);
 	super->major = ENVFS_MAJOR;
 	super->minor = ENVFS_MINOR;
@@ -320,7 +320,7 @@ static int envfs_load_data(struct envfs_super *super, void *buf, size_t size,
 		struct envfs_inode_end *inode_end;
 		uint32_t inode_size, inode_headerlen, namelen;
 
-		inode = (struct envfs_inode *)buf;
+		inode = buf;
 		buf += sizeof(struct envfs_inode);
 
 		if (ENVFS_32(inode->magic) != ENVFS_INODE_MAGIC) {
@@ -334,7 +334,7 @@ static int envfs_load_data(struct envfs_super *super, void *buf, size_t size,
 		if (super->major < 1)
 			inode_end = &inode_end_dummy;
 		else
-			inode_end = (struct envfs_inode_end *)(buf + PAD4(namelen));
+			inode_end = buf + PAD4(namelen);
 
 		debug("loading %s size %d namelen %d headerlen %d\n", inode->data,
 			inode_size, namelen, inode_headerlen);
@@ -355,7 +355,7 @@ static int envfs_load_data(struct envfs_super *super, void *buf, size_t size,
 
 		if (S_ISLNK(ENVFS_32(inode_end->mode))) {
 			debug("symlink: %s -> %s\n", str, (char*)buf);
-			if (symlink((char*)buf, str) < 0) {
+			if (symlink(buf, str) < 0) {
 				printf("symlink: %s -> %s :", str, (char*)buf);
 				perror("");
 			}
-- 
2.1.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2014-11-06 13:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-06 12:59 non volatile variables and incremental envrironment Sascha Hauer
2014-11-06 12:59 ` Sascha Hauer [this message]
2014-11-06 12:59 ` [PATCH 02/11] environment: remove unused variable Sascha Hauer
2014-11-06 12:59 ` [PATCH 03/11] environment: refactor saveenv Sascha Hauer
2014-11-06 12:59 ` [PATCH 04/11] environment: Only save changes to the defaultenv Sascha Hauer
2014-11-06 12:59 ` [PATCH 05/11] magicvar: Add support for dynamically added magicvars Sascha Hauer
2014-11-06 12:59 ` [PATCH 06/11] Add support for non volatile variables Sascha Hauer
2014-11-06 12:59 ` [PATCH 07/11] libfile: Add copy_recursive Sascha Hauer
2014-11-06 12:59 ` [PATCH 08/11] cp: Add recursive copy Sascha Hauer
2014-11-06 12:59 ` [PATCH 09/11] Add defaultenv command Sascha Hauer
2014-11-06 12:59 ` [PATCH 10/11] globalvar: Add support for printing all global variables Sascha Hauer
2014-11-06 12:59 ` [PATCH 11/11] defaultenv-2: Make use of nonvolatile variables Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1415278778-20826-2-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox