[Crosstoolchain-logs] [device-tree-compiler] 117/357: dtc: store labels in ascending order
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 43a68c63e46c88b94068c18255db2d6c7d9e3740
Author: Milton Miller <miltonm at bga.com>
Date: Sat Jul 7 01:18:52 2007 -0500
dtc: store labels in ascending order
When adding a label, walk to the end of the list since the
label reflects the end of the data.
Since merging data buffers already preserved the order, this
will cause the labels to be emitted in order when writing
assembly output.
It should also aid emiting labels when writing dts output
should that be added in the future (data formatting would
need to break at each label).
Signed-off-by: Milton Miller <miltonm at bga.com>
---
data.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/data.c b/data.c
index 3e96d11..f42ad58 100644
--- a/data.c
+++ b/data.c
@@ -301,16 +301,22 @@ struct data data_add_fixup(struct data d, char *ref)
struct data data_add_label(struct data d, char *label)
{
- struct fixup *f;
+ struct fixup *f, **p;
struct data nd;
f = xmalloc(sizeof(*f));
f->offset = d.len;
f->ref = label;
- f->next = d.labels;
nd = d;
- nd.labels = f;
+ p = &nd.labels;
+
+ /* adding to end keeps them sorted */
+ while (*p)
+ p = &((*p)->next);
+
+ f->next = *p;
+ *p = f;
return nd;
}
--
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