diff options
author | Anthony Green <green@cygnus.com> | 2000-02-19 23:02:33 +0000 |
---|---|---|
committer | Anthony Green <green@gcc.gnu.org> | 2000-02-19 23:02:33 +0000 |
commit | ccd4c273d9fd62fa7d57061387ad73ffb1043aa0 (patch) | |
tree | d42a5b7e18a7904cfb46daaf6316d480fb0a6438 | |
parent | 5df6c7801beb30670cba0333a160aeeb7095f339 (diff) | |
download | gcc-ccd4c273d9fd62fa7d57061387ad73ffb1043aa0.zip gcc-ccd4c273d9fd62fa7d57061387ad73ffb1043aa0.tar.gz gcc-ccd4c273d9fd62fa7d57061387ad73ffb1043aa0.tar.bz2 |
jcf-depend.c (add_entry): Add entries to the end of the list.
* jcf-depend.c (add_entry): Add entries to the end of the list.
I
From-SVN: r32066
-rw-r--r-- | gcc/java/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/java/jcf-depend.c | 18 |
2 files changed, 17 insertions, 5 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index e3b1992..450b481 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,7 @@ +2000-02-19 Anthony Green <green@cygnus.com> + + * jcf-depend.c (add_entry): Add entries to the end of the list. + Wed Nov 03 02:16:00 PST 1999 Pekka Nikander <pekka.nikander@hut.fi> * decl.c (INT_TYPE_SIZE): Define if necessary. diff --git a/gcc/java/jcf-depend.c b/gcc/java/jcf-depend.c index 8a9ee9e..53bd17b 100644 --- a/gcc/java/jcf-depend.c +++ b/gcc/java/jcf-depend.c @@ -78,22 +78,30 @@ free_entry (entp) *entp = NULL; } -/* Helper to add to entry list. */ +/* Helper to add to the end of the entry list. */ static void add_entry (entp, name) struct entry **entp; const char *name; { - struct entry *ent; + struct entry *ent, *last; - for (ent = *entp; ent != NULL; ent = ent->next) + for (last = ent = *entp; ent != NULL; last = ent, ent = ent->next) if (! strcmp (ent->file, name)) return; ent = (struct entry *) xmalloc (sizeof (struct entry)); ent->file = xstrdup (name); - ent->next = *entp; - *entp = ent; + ent->next = NULL; + + if (last == ent) + { + // This is only true the first time through, when the entry list + // is empty. + *entp = ent; + } + else + last->next = ent; } /* Call this to reset the dependency module. This is required if |