/* PSPP - a program for statistical analysis.
- Copyright (C) 2008 Free Software Foundation, Inc.
+ Copyright (C) 2008, 2009 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
{
if (map != NULL)
{
- if (hmapx_count (map) > 0)
+ if (!(hmapx_is_empty (map)))
{
struct hmapx_node *node, *next;
for (node = hmapx_first (map); node != NULL; node = next)
/* PSPP - a program for statistical analysis.
- Copyright (C) 2008 Free Software Foundation, Inc.
+ Copyright (C) 2008, 2009 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
const struct hmapx_node *);
/* Counting. */
+static inline bool hmapx_is_empty (const struct hmapx *);
static inline size_t hmapx_count (const struct hmapx *);
static inline size_t hmapx_capacity (const struct hmapx *);
return HMAP_NEXT (node, struct hmapx_node, hmap_node, &map->hmap);
}
+/* Returns true if MAP currently contains no data items, false
+ otherwise. */
+static inline bool
+hmapx_is_empty (const struct hmapx *map)
+{
+ return hmap_is_empty (&map->hmap);
+}
+
/* Returns the number of data items currently in MAP. */
static inline size_t
hmapx_count (const struct hmapx *map)
/* PSPP - a program for statistical analysis.
- Copyright (C) 2007, 2008 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2008, 2009 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
size_t i, j;
int *order;
+ check (hmapx_is_empty (hmapx) == (cnt == 0));
check (hmapx_count (hmapx) == cnt);
check (cnt <= hmapx_capacity (hmapx));