]> gcc.gnu.org Git - gcc.git/blame - gcc/bi-reverse.c
Make more robust in two places.
[gcc.git] / gcc / bi-reverse.c
CommitLineData
538d56bb
JB
1/* Reverse order of definitions obtained from bytecode definition file.
2 Copyright (C) 1993 Free Software Foundation, Inc.
3
4This file is part of GNU CC.
5
6GNU CC is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation; either version 2, or (at your option)
9any later version.
10
11GNU CC is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU CC; see the file COPYING. If not, write to
18the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
19
20
406b2050 21#include "hconfig.h"
538d56bb
JB
22#include "bi-defs.h"
23
538d56bb
JB
24void
25reverse()
26{
27 struct def *dp, *d, *dn;
28 struct variation *vp, *v, *vn;
29
30 dp = defs;
31 if (dp)
32 {
33 vp = dp->variations;
34 if (vp)
35 {
d5cbc4a3 36 for (v = vp->next, vp->next = 0; v; vp = v, v = vn)
538d56bb
JB
37 {
38 vn = v->next;
39 v->next = vp;
40 }
41 dp->variations = vp;
42 }
d5cbc4a3 43 for (d = dp->next, dp->next = 0; d; dp = d, d = dn)
538d56bb
JB
44 {
45 vp = d->variations;
46 if (vp)
47 {
d5cbc4a3 48 for (v = vp->next, vp->next = 0; v; vp = v, v = vn)
538d56bb
JB
49 {
50 vn = v->next;
51 v->next = vp;
52 }
53 d->variations = vp;
54 }
55 dn = d->next;
56 d->next = dp;
57 }
58 defs = dp;
59 }
60}
This page took 0.050598 seconds and 5 git commands to generate.