OSDN Git Service
(root)
/
pf3gnuchains
/
gcc-fork.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix build regression
[pf3gnuchains/gcc-fork.git]
/
libiberty
/
partition.c
diff --git
a/libiberty/partition.c
b/libiberty/partition.c
index
c1d5847
..
5f0745c
100644
(file)
--- a/
libiberty/partition.c
+++ b/
libiberty/partition.c
@@
-1,5
+1,5
@@
-/* List implentation of a partition of consecutive integers.
- Copyright (C) 2000 Free Software Foundation, Inc.
+/* List imple
me
ntation of a partition of consecutive integers.
+ Copyright (C) 2000
, 2001
Free Software Foundation, Inc.
Contributed by CodeSourcery, LLC.
This file is part of GNU CC.
Contributed by CodeSourcery, LLC.
This file is part of GNU CC.
@@
-16,8
+16,8
@@
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
- the Free Software Foundation, 5
9 Temple Place - Suite 330
,
- Boston, MA 0211
1-1307
, USA. */
+ the Free Software Foundation, 5
1 Franklin Street - Fifth Floor
,
+ Boston, MA 0211
0-1301
, USA. */
#ifdef HAVE_CONFIG_H
#include "config.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
@@
-27,15
+27,20
@@
#include <stdlib.h>
#endif
#include <stdlib.h>
#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
#include "libiberty.h"
#include "partition.h"
#include "libiberty.h"
#include "partition.h"
+static int elem_compare (const void *, const void *);
+
/* Creates a partition of NUM_ELEMENTS elements. Initially each
element is in a class by itself. */
partition
/* Creates a partition of NUM_ELEMENTS elements. Initially each
element is in a class by itself. */
partition
-partition_new (num_elements)
- int num_elements;
+partition_new (int num_elements)
{
int e;
{
int e;
@@
-56,8
+61,7
@@
partition_new (num_elements)
/* Freeds a partition. */
void
/* Freeds a partition. */
void
-partition_delete (part)
- partition part;
+partition_delete (partition part)
{
free (part);
}
{
free (part);
}
@@
-68,10
+72,7
@@
partition_delete (part)
resulting union class. */
int
resulting union class. */
int
-partition_union (part, elem1, elem2)
- partition part;
- int elem1;
- int elem2;
+partition_union (partition part, int elem1, int elem2)
{
struct partition_elem *elements = part->elements;
struct partition_elem *e1;
{
struct partition_elem *elements = part->elements;
struct partition_elem *e1;
@@
-120,12
+121,10
@@
partition_union (part, elem1, elem2)
pointer to each. Used to qsort such an array. */
static int
pointer to each. Used to qsort such an array. */
static int
-elem_compare (elem1, elem2)
- const void *elem1;
- const void *elem2;
+elem_compare (const void *elem1, const void *elem2)
{
{
- int e1 = * (int *) elem1;
- int e2 = * (int *) elem2;
+ int e1 = * (
const
int *) elem1;
+ int e2 = * (
const
int *) elem2;
if (e1 < e2)
return -1;
else if (e1 > e2)
if (e1 < e2)
return -1;
else if (e1 > e2)
@@
-138,9
+137,7
@@
elem_compare (elem1, elem2)
class are sorted. */
void
class are sorted. */
void
-partition_print (part, fp)
- partition part;
- FILE *fp;
+partition_print (partition part, FILE *fp)
{
char *done;
int num_elements = part->num_elements;
{
char *done;
int num_elements = part->num_elements;
@@
-171,7
+168,7
@@
partition_print (part, fp)
c = elements[c].next - elements;
}
/* Sort them. */
c = elements[c].next - elements;
}
/* Sort them. */
- qsort ((void *) class_elements, count, sizeof (int),
&
elem_compare);
+ qsort ((void *) class_elements, count, sizeof (int), elem_compare);
/* Print them. */
fputc ('(', fp);
for (i = 0; i < count; ++i)
/* Print them. */
fputc ('(', fp);
for (i = 0; i < count; ++i)
@@
-180,6
+177,7
@@
partition_print (part, fp)
}
fputc (']', fp);
}
fputc (']', fp);
+ free (class_elements);
free (done);
}
free (done);
}