X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fgroup.c;h=25459edaae91c6ffc6253f5aff13c8c3df4fd6bb;hb=e210b20bf6f405637c8c03dd280b5a4a627191b8;hp=e394745e96496d6d9fae5f8f5d8c1ee01d6f21a1;hpb=c33f6387da9826d640ef1f21068bf5c94055ba77;p=pspp-builds.git diff --git a/src/group.c b/src/group.c index e394745e..25459eda 100644 --- a/src/group.c +++ b/src/group.c @@ -14,12 +14,18 @@ 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. */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ +#include +#include +#include "alloc.h" #include "hash.h" #include "group.h" -#include +#include "group_proc.h" +#include "str.h" +#include "var.h" +#include "misc.h" /* Return -1 if the id of a is less than b; +1 if greater than and @@ -33,22 +39,30 @@ compare_group(const struct group_statistics *a, } + unsigned hash_group(const struct group_statistics *g, int width) { unsigned id_hash; - if ( 0 == width ) - id_hash = hsh_hash_double (g->id.f); - else - id_hash = hsh_hash_bytes (g->id.s, width); + id_hash = hash_value(&g->id, width); return id_hash; } void -free_group(struct group_statistics *v, void *aux) +free_group(struct group_statistics *v, void *aux UNUSED) { free(v); } + + +struct group_proc * +group_proc_get (struct variable *v) +{ + /* This is not ideal, obviously. */ + if (v->aux == NULL) + var_attach_aux (v, xmalloc (sizeof (struct group_proc)), var_dtor_free); + return v->aux; +}