X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flibpspp%2Fmodel-checker.c;h=ee13422a046cad95519c405042e63003065db716;hb=5d1c47b1ef2d392ce223606139d45eac749d4c80;hp=0e73fec651110f2330c0e807fadbc766d5825a9e;hpb=d8493b3b0617cc447446a70b031a69079bc19002;p=pspp diff --git a/src/libpspp/model-checker.c b/src/libpspp/model-checker.c index 0e73fec651..ee13422a04 100644 --- a/src/libpspp/model-checker.c +++ b/src/libpspp/model-checker.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2007, 2009, 2010, 2011, 2013 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ #include -#include +#include "libpspp/model-checker.h" #include #include @@ -26,16 +26,16 @@ #include #include -#include -#include -#include -#include -#include -#include +#include "libpspp/argv-parser.h" +#include "libpspp/bit-vector.h" +#include "libpspp/compiler.h" +#include "libpspp/deque.h" +#include "libpspp/misc.h" +#include "libpspp/str.h" -#include "error.h" -#include "minmax.h" -#include "xalloc.h" +#include "gl/error.h" +#include "gl/minmax.h" +#include "gl/xalloc.h" /* Initializes PATH as an empty path. */ void @@ -886,7 +886,7 @@ struct mc_results static struct mc_results * mc_results_create (void) { - struct mc_results *results = xcalloc (1, sizeof (struct mc_results)); + struct mc_results *results = XCALLOC (1, struct mc_results); results->stop_reason = MC_CONTINUING; gettimeofday (&results->start, NULL); return results; @@ -1150,7 +1150,7 @@ struct mc /* Array of 2**(options->hash_bits) bits representing states already visited. */ - unsigned char *hash; + unsigned long int *hash; /* State queue. */ struct mc_state **queue; /* Array of pointers to states. */ @@ -1269,7 +1269,7 @@ mc_discard_dup_state (struct mc *mc, unsigned int hash) if (!mc->state_error && mc->options->hash_bits > 0) { hash &= (1u << mc->options->hash_bits) - 1; - if (TEST_BIT (mc->hash, hash)) + if (bitvector_is_set (mc->hash, hash)) { if (mc->options->verbosity > 2) fprintf (mc->options->output_file, @@ -1278,7 +1278,7 @@ mc_discard_dup_state (struct mc *mc, unsigned int hash) next_operation (mc); return true; } - SET_BIT (mc->hash, hash); + bitvector_set1 (mc->hash, hash); } return false; } @@ -1688,7 +1688,7 @@ init_mc (struct mc *mc, const struct mc_class *class, mc->results = mc_results_create (); mc->hash = (mc->options->hash_bits > 0 - ? xcalloc (1, DIV_RND_UP (1 << mc->options->hash_bits, CHAR_BIT)) + ? bitvector_allocate (1 << mc->options->hash_bits) : NULL); mc->queue = NULL; @@ -1743,7 +1743,7 @@ finish_mc (struct mc *mc) /* Free memory. */ mc_path_destroy (&mc->path); ds_destroy (&mc->path_string); - free (mc->options); + mc_options_destroy (mc->options); free (mc->queue); free (mc->hash); }