X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/2d382ea8534abc4e650927aa9bf5d09a4844e1d5..d6b771c345a389742bfcd73ff13dac1d4f016c88:/lib/bitset_stats.c diff --git a/lib/bitset_stats.c b/lib/bitset_stats.c index 040e87d3..7b7fb341 100644 --- a/lib/bitset_stats.c +++ b/lib/bitset_stats.c @@ -1,5 +1,5 @@ /* Bitset statistics. - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz). This program is free software; you can redistribute it and/or modify @@ -13,26 +13,25 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ + along with this program; if not, write to the Free Software Foundation, + Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* This file is a wrapper bitset implementation for the other bitset implementations. It provides bitset compatibility checking and statistics gathering without having to instrument the bitset implementations. When statistics gathering is enabled, the bitset operations get vectored through here and we then call the appropriate - routines. -*/ + routines. */ #ifdef HAVE_CONFIG_H -#include "config.h" +# include #endif #include "bbitset.h" #include "abitset.h" #include "ebitset.h" #include "lbitset.h" +#include "vbitset.h" #include "bitset_stats.h" #include #include @@ -49,45 +48,32 @@ /* Accessor macros. */ -#define BITSET_STATS_ALLOCS_INC(TYPE) \ +#define BITSET_STATS_ALLOCS_INC(TYPE) \ bitset_stats_info->types[(TYPE)].allocs++ -#define BITSET_STATS_FREES_INC(BSET) \ +#define BITSET_STATS_FREES_INC(BSET) \ bitset_stats_info->types[BITSET_TYPE_ (BSET)].frees++ -#define BITSET_STATS_SETS_INC(BSET) \ +#define BITSET_STATS_SETS_INC(BSET) \ bitset_stats_info->types[BITSET_TYPE_ (BSET)].sets++ -#define BITSET_STATS_CACHE_SETS_INC(BSET) \ +#define BITSET_STATS_CACHE_SETS_INC(BSET) \ bitset_stats_info->types[BITSET_TYPE_ (BSET)].cache_sets++ -#define BITSET_STATS_RESETS_INC(BSET) \ +#define BITSET_STATS_RESETS_INC(BSET) \ bitset_stats_info->types[BITSET_TYPE_ (BSET)].resets++ -#define BITSET_STATS_CACHE_RESETS_INC(BSET) \ +#define BITSET_STATS_CACHE_RESETS_INC(BSET) \ bitset_stats_info->types[BITSET_TYPE_ (BSET)].cache_resets++ -#define BITSET_STATS_TESTS_INC(BSET) \ +#define BITSET_STATS_TESTS_INC(BSET) \ bitset_stats_info->types[BITSET_TYPE_ (BSET)].tests++ -#define BITSET_STATS_CACHE_TESTS_INC(BSET) \ +#define BITSET_STATS_CACHE_TESTS_INC(BSET) \ bitset_stats_info->types[BITSET_TYPE_ (BSET)].cache_tests++ -#define BITSET_STATS_LISTS_INC(BSET) \ +#define BITSET_STATS_LISTS_INC(BSET) \ bitset_stats_info->types[BITSET_TYPE_ (BSET)].lists++ -#define BITSET_STATS_LIST_COUNTS_INC(BSET, I) \ +#define BITSET_STATS_LIST_COUNTS_INC(BSET, I) \ bitset_stats_info->types[BITSET_TYPE_ (BSET)].list_counts[(I)]++ -#define BITSET_STATS_LIST_SIZES_INC(BSET, I) \ +#define BITSET_STATS_LIST_SIZES_INC(BSET, I) \ bitset_stats_info->types[BITSET_TYPE_ (BSET)].list_sizes[(I)]++ -#define BITSET_STATS_LIST_DENSITY_INC(BSET, I) \ +#define BITSET_STATS_LIST_DENSITY_INC(BSET, I) \ bitset_stats_info->types[BITSET_TYPE_ (BSET)].list_density[(I)]++ -typedef struct bitset_stats_struct -{ - bitset bset; -} *bitset_stats; - - -struct bitset_struct -{ - struct bbitset_struct b; - struct bitset_stats_struct s; -}; - - struct bitset_type_info_struct { unsigned int allocs; @@ -113,41 +99,13 @@ struct bitset_stats_info_struct struct bitset_stats_info_struct bitset_stats_info_data; struct bitset_stats_info_struct *bitset_stats_info; -int bitset_stats_enabled = 0; - - -static void bitset_stats_set PARAMS ((bitset, bitset_bindex)); -static void bitset_stats_reset PARAMS ((bitset, bitset_bindex)); -static int bitset_stats_toggle PARAMS ((bitset, bitset_bindex)); -static int bitset_stats_test PARAMS ((bitset, bitset_bindex)); -static bitset_bindex bitset_stats_size PARAMS ((bitset)); -static bitset_bindex bitset_stats_list PARAMS ((bitset, bitset_bindex *, - bitset_bindex, - bitset_bindex *)); -static bitset_bindex bitset_stats_list_reverse -PARAMS ((bitset, bitset_bindex *, bitset_bindex, bitset_bindex *)); -static void bitset_stats_free PARAMS ((bitset)); -static void bitset_percent_histogram_print PARAMS ((FILE *, const char *, - const char *, - unsigned int, - unsigned int *)); -static void bitset_log_histogram_print PARAMS ((FILE *, const char *, - const char *, - unsigned int, - unsigned int *)); -static void bitset_stats_print_1 -PARAMS ((FILE *, const char *, struct bitset_type_info_struct *)); -static void bitset_stats_print PARAMS ((FILE *, int)); +bool bitset_stats_enabled = false; /* Print a percentage histogram with message MSG to FILE. */ static void -bitset_percent_histogram_print (file, name, msg, n_bins, bins) - FILE *file; - const char *name; - const char *msg; - unsigned int n_bins; - unsigned int *bins; +bitset_percent_histogram_print (FILE *file, const char *name, const char *msg, + unsigned int n_bins, unsigned int *bins) { unsigned int i; unsigned int total; @@ -170,12 +128,8 @@ bitset_percent_histogram_print (file, name, msg, n_bins, bins) /* Print a log histogram with message MSG to FILE. */ static void -bitset_log_histogram_print (file, name, msg, n_bins, bins) - FILE *file; - const char *name; - const char *msg; - unsigned int n_bins; - unsigned int *bins; +bitset_log_histogram_print (FILE *file, const char *name, const char *msg, + unsigned int n_bins, unsigned int *bins) { unsigned int i; unsigned int total; @@ -204,8 +158,8 @@ bitset_log_histogram_print (file, name, msg, n_bins, bins) for (; i < n_bins; i++) fprintf (file, "%*lu-%lu\t%8u (%5.1f%%)\n", max_width - ((unsigned int) (0.30103 * (i) + 0.9999) + 1), - (unsigned long) 1 << (i - 1), - ((unsigned long) 1 << i) - 1, + 1UL << (i - 1), + (1UL << i) - 1, bins[i], (100.0 * bins[i]) / total); } @@ -213,14 +167,12 @@ bitset_log_histogram_print (file, name, msg, n_bins, bins) /* Print bitset statistics to FILE. */ static void -bitset_stats_print_1 (file, name, stats) - FILE *file; - const char *name; - struct bitset_type_info_struct *stats; +bitset_stats_print_1 (FILE *file, const char *name, + struct bitset_type_info_struct *stats) { if (!stats) return; - + fprintf (file, "%s:\n", name); fprintf (file, _("%u bitset_allocs, %u freed (%.2f%%).\n"), stats->allocs, stats->frees, @@ -250,9 +202,7 @@ bitset_stats_print_1 (file, name, stats) /* Print all bitset statistics to FILE. */ static void -bitset_stats_print (file, verbose) - FILE *file; - int verbose ATTRIBUTE_UNUSED; +bitset_stats_print (FILE *file, bool verbose ATTRIBUTE_UNUSED) { int i; @@ -265,42 +215,41 @@ bitset_stats_print (file, verbose) fprintf (file, _("Accumulated runs = %u\n"), bitset_stats_info->runs); for (i = 0; i < BITSET_TYPE_NUM; i++) - bitset_stats_print_1 (file, bitset_type_names[i], + bitset_stats_print_1 (file, bitset_type_names[i], &bitset_stats_info->types[i]); } /* Initialise bitset statistics logging. */ void -bitset_stats_enable () +bitset_stats_enable (void) { if (!bitset_stats_info) bitset_stats_info = &bitset_stats_info_data; - bitset_stats_enabled = 1; + bitset_stats_enabled = true; } void -bitset_stats_disable () +bitset_stats_disable (void) { - bitset_stats_enabled = 0; + bitset_stats_enabled = false; } /* Read bitset statistics file. */ void -bitset_stats_read (filename) - const char *filename; +bitset_stats_read (const char *file_name) { FILE *file; if (!bitset_stats_info) return; - - if (!filename) - filename = BITSET_STATS_FILE; - file = fopen (filename, "r"); + if (!file_name) + file_name = BITSET_STATS_FILE; + + file = fopen (file_name, "r"); if (file) { if (fread (&bitset_stats_info_data, sizeof (bitset_stats_info_data), @@ -311,7 +260,8 @@ bitset_stats_read (filename) else fprintf (stderr, _("Bad stats file size.\n")); } - fclose (file); + if (fclose (file) != 0) + perror (_("Could not read stats file.")); } bitset_stats_info_data.runs++; } @@ -319,24 +269,24 @@ bitset_stats_read (filename) /* Write bitset statistics file. */ void -bitset_stats_write (filename) - const char *filename; +bitset_stats_write (const char *file_name) { FILE *file; if (!bitset_stats_info) return; - if (!filename) - filename = BITSET_STATS_FILE; + if (!file_name) + file_name = BITSET_STATS_FILE; - file = fopen (filename, "w"); + file = fopen (file_name, "w"); if (file) { if (fwrite (&bitset_stats_info_data, sizeof (bitset_stats_info_data), 1, file) != 1) perror (_("Could not write stats file.")); - fclose (file); + if (fclose (file) != 0) + perror (_("Could not write stats file.")); } else perror (_("Could not open stats file for writing.")); @@ -345,10 +295,9 @@ bitset_stats_write (filename) /* Dump bitset statistics to FILE. */ void -bitset_stats_dump (file) - FILE *file; +bitset_stats_dump (FILE *file) { - bitset_stats_print (file, 0); + bitset_stats_print (file, false); } @@ -356,19 +305,17 @@ bitset_stats_dump (file) void debug_bitset_stats (void) { - bitset_stats_print (stderr, 1); + bitset_stats_print (stderr, true); } static void -bitset_stats_set (dst, bitno) - bitset dst; - bitset_bindex bitno; +bitset_stats_set (bitset dst, bitset_bindex bitno) { bitset bset = dst->s.bset; bitset_windex wordno = bitno / BITSET_WORD_BITS; bitset_windex offset = wordno - bset->b.cindex; - + BITSET_STATS_SETS_INC (bset); if (offset < bset->b.csize) @@ -382,14 +329,12 @@ bitset_stats_set (dst, bitno) static void -bitset_stats_reset (dst, bitno) - bitset dst; - bitset_bindex bitno; +bitset_stats_reset (bitset dst, bitset_bindex bitno) { bitset bset = dst->s.bset; bitset_windex wordno = bitno / BITSET_WORD_BITS; bitset_windex offset = wordno - bset->b.cindex; - + BITSET_STATS_RESETS_INC (bset); if (offset < bset->b.csize) @@ -403,26 +348,22 @@ bitset_stats_reset (dst, bitno) } -static int -bitset_stats_toggle (src, bitno) - bitset src; - bitset_bindex bitno; +static bool +bitset_stats_toggle (bitset src, bitset_bindex bitno) { return BITSET_TOGGLE_ (src->s.bset, bitno); } -static int -bitset_stats_test (src, bitno) - bitset src; - bitset_bindex bitno; +static bool +bitset_stats_test (bitset src, bitset_bindex bitno) { bitset bset = src->s.bset; bitset_windex wordno = bitno / BITSET_WORD_BITS; bitset_windex offset = wordno - bset->b.cindex; BITSET_STATS_TESTS_INC (bset); - + if (offset < bset->b.csize) { BITSET_STATS_CACHE_TESTS_INC (bset); @@ -434,69 +375,65 @@ bitset_stats_test (src, bitno) static bitset_bindex -bitset_stats_size (src) - bitset src; +bitset_stats_resize (bitset src, bitset_bindex size) +{ + return BITSET_RESIZE_ (src->s.bset, size); +} + + +static bitset_bindex +bitset_stats_size (bitset src) { return BITSET_SIZE_ (src->s.bset); } static bitset_bindex -bitset_stats_count (src) - bitset src; +bitset_stats_count (bitset src) { return BITSET_COUNT_ (src->s.bset); } -static int -bitset_stats_empty_p (dst) - bitset dst; +static bool +bitset_stats_empty_p (bitset dst) { return BITSET_EMPTY_P_ (dst->s.bset); } static void -bitset_stats_ones (dst) - bitset dst; +bitset_stats_ones (bitset dst) { BITSET_ONES_ (dst->s.bset); } static void -bitset_stats_zero (dst) - bitset dst; +bitset_stats_zero (bitset dst) { BITSET_ZERO_ (dst->s.bset); } static void -bitset_stats_copy (dst, src) - bitset dst; - bitset src; +bitset_stats_copy (bitset dst, bitset src) { BITSET_CHECK2_ (dst, src); BITSET_COPY_ (dst->s.bset, src->s.bset); } -static int -bitset_stats_disjoint_p (dst, src) - bitset dst; - bitset src; +static bool +bitset_stats_disjoint_p (bitset dst, bitset src) { BITSET_CHECK2_ (dst, src); return BITSET_DISJOINT_P_ (dst->s.bset, src->s.bset); } -static int -bitset_stats_equal_p (dst, src) - bitset dst; - bitset src; +static bool +bitset_stats_equal_p (bitset dst, bitset src) { BITSET_CHECK2_ (dst, src); return BITSET_EQUAL_P_ (dst->s.bset, src->s.bset); @@ -504,19 +441,15 @@ bitset_stats_equal_p (dst, src) static void -bitset_stats_not (dst, src) - bitset dst; - bitset src; +bitset_stats_not (bitset dst, bitset src) { BITSET_CHECK2_ (dst, src); BITSET_NOT_ (dst->s.bset, src->s.bset); } -static int -bitset_stats_subset_p (dst, src) - bitset dst; - bitset src; +static bool +bitset_stats_subset_p (bitset dst, bitset src) { BITSET_CHECK2_ (dst, src); return BITSET_SUBSET_P_ (dst->s.bset, src->s.bset); @@ -524,21 +457,15 @@ bitset_stats_subset_p (dst, src) static void -bitset_stats_and (dst, src1, src2) - bitset dst; - bitset src1; - bitset src2; +bitset_stats_and (bitset dst, bitset src1, bitset src2) { BITSET_CHECK3_ (dst, src1, src2); BITSET_AND_ (dst->s.bset, src1->s.bset, src2->s.bset); } -static int -bitset_stats_and_cmp (dst, src1, src2) - bitset dst; - bitset src1; - bitset src2; +static bool +bitset_stats_and_cmp (bitset dst, bitset src1, bitset src2) { BITSET_CHECK3_ (dst, src1, src2); return BITSET_AND_CMP_ (dst->s.bset, src1->s.bset, src2->s.bset); @@ -546,21 +473,15 @@ bitset_stats_and_cmp (dst, src1, src2) static void -bitset_stats_andn (dst, src1, src2) - bitset dst; - bitset src1; - bitset src2; +bitset_stats_andn (bitset dst, bitset src1, bitset src2) { BITSET_CHECK3_ (dst, src1, src2); BITSET_ANDN_ (dst->s.bset, src1->s.bset, src2->s.bset); } -static int -bitset_stats_andn_cmp (dst, src1, src2) - bitset dst; - bitset src1; - bitset src2; +static bool +bitset_stats_andn_cmp (bitset dst, bitset src1, bitset src2) { BITSET_CHECK3_ (dst, src1, src2); return BITSET_ANDN_CMP_ (dst->s.bset, src1->s.bset, src2->s.bset); @@ -568,21 +489,15 @@ bitset_stats_andn_cmp (dst, src1, src2) static void -bitset_stats_or (dst, src1, src2) - bitset dst; - bitset src1; - bitset src2; +bitset_stats_or (bitset dst, bitset src1, bitset src2) { BITSET_CHECK3_ (dst, src1, src2); BITSET_OR_ (dst->s.bset, src1->s.bset, src2->s.bset); } -static int -bitset_stats_or_cmp (dst, src1, src2) - bitset dst; - bitset src1; - bitset src2; +static bool +bitset_stats_or_cmp (bitset dst, bitset src1, bitset src2) { BITSET_CHECK3_ (dst, src1, src2); return BITSET_OR_CMP_ (dst->s.bset, src1->s.bset, src2->s.bset); @@ -590,21 +505,15 @@ bitset_stats_or_cmp (dst, src1, src2) static void -bitset_stats_xor (dst, src1, src2) - bitset dst; - bitset src1; - bitset src2; +bitset_stats_xor (bitset dst, bitset src1, bitset src2) { BITSET_CHECK3_ (dst, src1, src2); BITSET_XOR_ (dst->s.bset, src1->s.bset, src2->s.bset); } -static int -bitset_stats_xor_cmp (dst, src1, src2) - bitset dst; - bitset src1; - bitset src2; +static bool +bitset_stats_xor_cmp (bitset dst, bitset src1, bitset src2) { BITSET_CHECK3_ (dst, src1, src2); return BITSET_XOR_CMP_ (dst->s.bset, src1->s.bset, src2->s.bset); @@ -612,89 +521,56 @@ bitset_stats_xor_cmp (dst, src1, src2) static void -bitset_stats_and_or (dst, src1, src2, src3) - bitset dst; - bitset src1; - bitset src2; - bitset src3; +bitset_stats_and_or (bitset dst, bitset src1, bitset src2, bitset src3) { BITSET_CHECK4_ (dst, src1, src2, src3); - BITSET_AND_OR_ (dst->s.bset, src1->s.bset, src2->s.bset, src3->s.bset); } -static int -bitset_stats_and_or_cmp (dst, src1, src2, src3) - bitset dst; - bitset src1; - bitset src2; - bitset src3; +static bool +bitset_stats_and_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3) { BITSET_CHECK4_ (dst, src1, src2, src3); - return BITSET_AND_OR_CMP_ (dst->s.bset, src1->s.bset, src2->s.bset, src3->s.bset); } static void -bitset_stats_andn_or (dst, src1, src2, src3) - bitset dst; - bitset src1; - bitset src2; - bitset src3; +bitset_stats_andn_or (bitset dst, bitset src1, bitset src2, bitset src3) { BITSET_CHECK4_ (dst, src1, src2, src3); - BITSET_ANDN_OR_ (dst->s.bset, src1->s.bset, src2->s.bset, src3->s.bset); } -static int -bitset_stats_andn_or_cmp (dst, src1, src2, src3) - bitset dst; - bitset src1; - bitset src2; - bitset src3; +static bool +bitset_stats_andn_or_cmp (bitset dst, bitset src1, bitset src2, bitset src3) { BITSET_CHECK4_ (dst, src1, src2, src3); - return BITSET_ANDN_OR_CMP_ (dst->s.bset, src1->s.bset, src2->s.bset, src3->s.bset); } static void -bitset_stats_or_and (dst, src1, src2, src3) - bitset dst; - bitset src1; - bitset src2; - bitset src3; +bitset_stats_or_and (bitset dst, bitset src1, bitset src2, bitset src3) { BITSET_CHECK4_ (dst, src1, src2, src3); - BITSET_OR_AND_ (dst->s.bset, src1->s.bset, src2->s.bset, src3->s.bset); } -static int -bitset_stats_or_and_cmp (dst, src1, src2, src3) - bitset dst; - bitset src1; - bitset src2; - bitset src3; +static bool +bitset_stats_or_and_cmp (bitset dst, bitset src1, bitset src2, bitset src3) { BITSET_CHECK4_ (dst, src1, src2, src3); - return BITSET_OR_AND_CMP_ (dst->s.bset, src1->s.bset, src2->s.bset, src3->s.bset); } static bitset_bindex -bitset_stats_list (bset, list, num, next) - bitset bset; - bitset_bindex *list; - bitset_bindex num; - bitset_bindex *next; +bitset_stats_list (bitset bset, bitset_bindex *list, + bitset_bindex num, bitset_bindex *next) { bitset_bindex count; bitset_bindex tmp; @@ -703,17 +579,17 @@ bitset_stats_list (bset, list, num, next) enum bitset_type type; count = BITSET_LIST_ (bset->s.bset, list, num, next); - + type = BITSET_TYPE_ (bset->s.bset); BITSET_STATS_LISTS_INC (bset->s.bset); - + /* Log histogram of number of set bits. */ for (i = 0, tmp = count; tmp; tmp >>= 1, i++) continue; if (i >= BITSET_LOG_COUNT_BINS) i = BITSET_LOG_COUNT_BINS - 1; BITSET_STATS_LIST_COUNTS_INC (bset->s.bset, i); - + /* Log histogram of number of bits in set. */ size = BITSET_SIZE_ (bset->s.bset); for (i = 0, tmp = size; tmp; tmp >>= 1, i++) @@ -721,7 +597,7 @@ bitset_stats_list (bset, list, num, next) if (i >= BITSET_LOG_SIZE_BINS) i = BITSET_LOG_SIZE_BINS - 1; BITSET_STATS_LIST_SIZES_INC (bset->s.bset, i); - + /* Histogram of fraction of bits set. */ i = size ? (count * BITSET_DENSITY_BINS) / size : 0; if (i >= BITSET_DENSITY_BINS) @@ -732,19 +608,15 @@ bitset_stats_list (bset, list, num, next) static bitset_bindex -bitset_stats_list_reverse (bset, list, num, next) - bitset bset; - bitset_bindex *list; - bitset_bindex num; - bitset_bindex *next; +bitset_stats_list_reverse (bitset bset, bitset_bindex *list, + bitset_bindex num, bitset_bindex *next) { return BITSET_LIST_REVERSE_ (bset->s.bset, list, num, next); } static void -bitset_stats_free (bset) - bitset bset; +bitset_stats_free (bitset bset) { BITSET_STATS_FREES_INC (bset->s.bset); BITSET_FREE_ (bset->s.bset); @@ -756,6 +628,7 @@ struct bitset_vtable bitset_stats_vtable = { bitset_stats_reset, bitset_stats_toggle, bitset_stats_test, + bitset_stats_resize, bitset_stats_size, bitset_stats_count, bitset_stats_empty_p, @@ -789,8 +662,7 @@ struct bitset_vtable bitset_stats_vtable = { /* Return enclosed bitset type. */ enum bitset_type -bitset_stats_type_get (bset) - bitset bset; +bitset_stats_type_get (bitset bset) { return BITSET_TYPE_ (bset->s.bset); } @@ -799,15 +671,12 @@ bitset_stats_type_get (bset) size_t bitset_stats_bytes (void) { - return sizeof (struct bitset_struct); + return sizeof (struct bitset_stats_struct); } bitset -bitset_stats_init (bset, n_bits, type) - bitset bset; - bitset_bindex n_bits; - enum bitset_type type; +bitset_stats_init (bitset bset, bitset_bindex n_bits, enum bitset_type type) { size_t bytes; bitset sbset; @@ -819,35 +688,43 @@ bitset_stats_init (bset, n_bits, type) bset->b.csize = 0; bset->b.cdata = 0; + BITSET_NBITS_ (bset) = n_bits; + /* Set up the actual bitset implementation that we are a wrapper over. */ switch (type) { + default: + abort (); + case BITSET_ARRAY: bytes = abitset_bytes (n_bits); - sbset = (bitset) xcalloc (1, bytes); + sbset = xcalloc (1, bytes); abitset_init (sbset, n_bits); break; case BITSET_LIST: bytes = lbitset_bytes (n_bits); - sbset = (bitset) xcalloc (1, bytes); + sbset = xcalloc (1, bytes); lbitset_init (sbset, n_bits); break; case BITSET_TABLE: bytes = ebitset_bytes (n_bits); - sbset = (bitset) xcalloc (1, bytes); + sbset = xcalloc (1, bytes); ebitset_init (sbset, n_bits); break; - default: - abort (); + case BITSET_VARRAY: + bytes = vbitset_bytes (n_bits); + sbset = xcalloc (1, bytes); + vbitset_init (sbset, n_bits); + break; } bset->s.bset = sbset; BITSET_STATS_ALLOCS_INC (type); - + return bset; }