/* PSPP - a program for statistical analysis.
- Copyright (C) 2007, 2009, 2010, 2011 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009, 2010, 2011, 2012 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
md4_process_bytes (&size, sizeof size, ctx);
}
- for (rsn = range_set_first (axis->available); rsn != NULL;
- rsn = range_set_next (axis->available, rsn))
+ RANGE_SET_FOR_EACH (rsn, axis->available)
{
unsigned long int start = range_set_node_get_start (rsn);
unsigned long int end = range_set_node_get_end (rsn);
static inline bool range_set_is_empty (const struct range_set *);
+#define RANGE_SET_FOR_EACH(NODE, RANGE_SET) \
+ for ((NODE) = range_set_first (RANGE_SET); \
+ (NODE) != NULL; \
+ (NODE) = range_set_next (RANGE_SET, NODE))
+
static inline const struct range_set_node *range_set_first (
const struct range_set *);
static inline const struct range_set_node *range_set_next (
/* PSPP - a program for statistical analysis.
- Copyright (C) 2007, 2009, 2010, 2011 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009, 2010, 2011, 2012 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
new->disk = ext_array_create ();
new->disk_rows = range_set_clone (old->disk_rows, NULL);
- for (node = range_set_first (old->disk_rows); node != NULL;
- node = range_set_next (old->disk_rows, node))
+ RANGE_SET_FOR_EACH (node, old->disk_rows)
{
unsigned long int start = range_set_node_get_start (node);
unsigned long int end = range_set_node_get_end (node);
{
const struct range_set_node *node;
- for (node = range_set_first (sx->disk_rows); node != NULL;
- node = range_set_next (sx->disk_rows, node))
+ RANGE_SET_FOR_EACH (node, sx->disk_rows)
{
unsigned long int start_row = range_set_node_get_start (node);
unsigned long int end_row = range_set_node_get_end (node);
const struct range_set_node *node;
void *tmp = xmalloc (sx->n_bytes);
- for (node = range_set_first (sx->disk_rows); node != NULL;
- node = range_set_next (sx->disk_rows, node))
+ RANGE_SET_FOR_EACH (node, sx->disk_rows)
{
unsigned long int start = range_set_node_get_start (node);
unsigned long int end = range_set_node_get_end (node);
void *tmp = xmalloc (sx->n_bytes);
md4_process_bytes ("d", 1, &ctx);
- for (node = range_set_first (sx->disk_rows); node != NULL;
- node = range_set_next (sx->disk_rows, node))
+ RANGE_SET_FOR_EACH (node, sx->disk_rows)
{
unsigned long int start = range_set_node_get_start (node);
unsigned long int end = range_set_node_get_end (node);
/* PSPP - a program for statistical analysis.
- Copyright (C) 2007, 2009, 2010, 2011 Free Software Foundation, Inc.
+ Copyright (C) 2007, 2009, 2010, 2011, 2012 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 range_set_node *node;
printf ("result:");
- for (node = range_set_first (rs); node != NULL;
- node = range_set_next (rs, node))
+ RANGE_SET_FOR_EACH (node, rs)
printf (" (%lu,%lu)",
range_set_node_get_start (node), range_set_node_get_end (node));
printf ("\n");