[Crosstoolchain-logs] [device-tree-compiler] 114/357: dtc: clean up grow_data_for()

Hector Oron zumbi at moszumanska.debian.org
Thu Dec 8 17:05:56 UTC 2016


This is an automated email from the git hooks/post-receive script.

zumbi pushed a commit to branch upstream/1.3.x
in repository device-tree-compiler.

commit 46779e8f8e5a13388835e9251fb741396e2d7f13
Author: Milton Miller <miltonm at bga.com>
Date:   Sat Jul 7 01:18:49 2007 -0500

    dtc: clean up grow_data_for()
    
    Change the grow_data_for function to copy struct data and
    modifiy the fields it is updating instead of storing all
    fields individually to a stack allocated struct.
    
    This reduces maintence for future enhancements as now all
    instances of struct data are created by modifying a copy
    of an existing struct data or directly copying empty_data.
    
    Signed-off-by: Milton Miller <miltonm at bga.com>
---
 data.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/data.c b/data.c
index 5d7db17..3d68792 100644
--- a/data.c
+++ b/data.c
@@ -57,6 +57,8 @@ struct data data_grow_for(struct data d, int xlen)
 	if (xlen == 0)
 		return d;
 
+	nd = d;
+
 	newsize = xlen;
 
 	while ((d.len + xlen) > newsize)
@@ -64,8 +66,6 @@ struct data data_grow_for(struct data d, int xlen)
 
 	nd.asize = newsize;
 	nd.val = xrealloc(d.val, newsize);
-	nd.len = d.len;
-	nd.refs = d.refs;
 
 	assert(nd.asize >= (d.len + xlen));
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/crosstoolchain/device-tree-compiler.git



More information about the Crosstoolchain-logs mailing list