X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=libiberty%2Fpartition.c;h=2e17515f2d61a483fedf475dc487658024458a11;hb=e3fed0f2fe98c52dc8cb160be2a30e973b1dca3f;hp=a5a734937ae9edb7d3fcf55eb7afbe3399a71efc;hpb=d0352a18a504a4e7b761f6b3264cf11347d8d056;p=deliverable%2Fbinutils-gdb.git diff --git a/libiberty/partition.c b/libiberty/partition.c index a5a734937a..2e17515f2d 100644 --- 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 implementation of a partition of consecutive integers. + Copyright (C) 2000-2020 Free Software Foundation, Inc. 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 - the Free Software Foundation, 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ + the Free Software Foundation, 51 Franklin Street - Fifth Floor, + Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -34,14 +34,13 @@ #include "libiberty.h" #include "partition.h" -static int elem_compare PARAMS ((const void *, const void *)); +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 -partition_new (num_elements) - int num_elements; +partition_new (int num_elements) { int e; @@ -62,8 +61,7 @@ partition_new (num_elements) /* Freeds a partition. */ void -partition_delete (part) - partition part; +partition_delete (partition part) { free (part); } @@ -74,10 +72,7 @@ partition_delete (part) 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; @@ -126,9 +121,7 @@ partition_union (part, elem1, elem2) 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 = * (const int *) elem1; int e2 = * (const int *) elem2; @@ -144,9 +137,7 @@ elem_compare (elem1, elem2) 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; @@ -186,6 +177,7 @@ partition_print (part, fp) } fputc (']', fp); + free (class_elements); free (done); }