axis_make_available (struct axis *axis,
unsigned long int start, unsigned long int width)
{
- range_set_insert (axis->available, start, width);
+ range_set_set1 (axis->available, start, width);
}
/* Extends the total physical length of AXIS by WIDTH and returns
size_t row_size = n_bytes + 4 * sizeof (void *);
size_t max_memory_rows = settings_get_workspace () / row_size;
source->avail = range_set_create ();
- range_set_insert (source->avail, 0, n_bytes);
+ range_set_set1 (source->avail, 0, n_bytes);
source->data = sparse_xarray_create (n_bytes, MAX (max_memory_rows, 4));
source->backing = NULL;
source->backing_rows = 0;
size_t n_columns;
size_t i;
- range_set_delete (source->avail, 0, n_bytes);
+ range_set_set0 (source->avail, 0, n_bytes);
source->backing = reader;
source->backing_rows = casereader_count_cases (reader);
source_release_column (struct source *source, int ofs, int width)
{
assert (width >= 0);
- range_set_insert (source->avail, ofs, width_to_n_bytes (width));
+ range_set_set1 (source->avail, ofs, width_to_n_bytes (width));
if (source->backing != NULL)
source->n_used--;
}
/* Inserts the region starting at START and extending for WIDTH
into RS. */
void
-range_set_insert (struct range_set *rs,
- unsigned long int start, unsigned long int width)
+range_set_set1 (struct range_set *rs,
+ unsigned long int start, unsigned long int width)
{
unsigned long int end = start + width;
struct range_set_node *node;
/* Deletes the region starting at START and extending for WIDTH
from RS. */
void
-range_set_delete (struct range_set *rs,
- unsigned long int start, unsigned long int width)
+range_set_set0 (struct range_set *rs,
+ unsigned long int start, unsigned long int width)
{
unsigned long int end = start + width;
struct range_set_node *node;
struct range_set *range_set_clone (const struct range_set *, struct pool *);
void range_set_destroy (struct range_set *);
-void range_set_insert (struct range_set *,
- unsigned long int start, unsigned long int width);
-void range_set_delete (struct range_set *,
- unsigned long int start, unsigned long int width);
+void range_set_set1 (struct range_set *,
+ unsigned long int start, unsigned long int width);
+void range_set_set0 (struct range_set *,
+ unsigned long int start, unsigned long int width);
bool range_set_allocate (struct range_set *, unsigned long int request,
unsigned long int *start, unsigned long int *width);
bool range_set_allocate_fully (struct range_set *, unsigned long int request,
/* Returns the node representing the first contiguous region of
1-bits in RS, or a null pointer if RS is empty.
- Any call to range_set_insert, range_set_delete, or
+ Any call to range_set_set1, range_set_set0, or
range_set_allocate invalidates the returned node. */
static inline const struct range_set_node *
range_set_first (const struct range_set *rs)
pointer if NODE is the last region in RS.
If NODE is null, returns the first region in RS, as for
range_set_first.
- Any call to range_set_insert, range_set_delete, or
+ Any call to range_set_set1, range_set_set0, or
range_set_allocate invalidates the returned node. */
static inline const struct range_set_node *
range_set_next (const struct range_set *rs, const struct range_set_node *node)
/* Returns the node representing the last contiguous region of
1-bits in RS, or a null pointer if RS is empty.
- Any call to range_set_insert, range_set_delete, or
+ Any call to range_set_set1, range_set_set0, or
range_set_allocate invalidates the returned node. */
static inline const struct range_set_node *
range_set_last (const struct range_set *rs)
pointer if NODE is the first region in RS.
If NODE is null, returns the last region in RS, as for
range_set_last.
- Any call to range_set_insert, range_set_delete, or
+ Any call to range_set_set1, range_set_set0, or
range_set_allocate invalidates the returned node. */
static inline const struct range_set_node *
range_set_prev (const struct range_set *rs, const struct range_set_node *node)
sx->disk_rows = NULL;
return false;
}
- range_set_insert (sx->disk_rows, idx, 1);
+ range_set_set1 (sx->disk_rows, idx, 1);
}
sparse_array_destroy (sx->memory);
sx->memory = NULL;
return ext_array_write (sx->disk, ofs + start, n, data);
else
{
- range_set_insert (sx->disk_rows, row, 1);
+ range_set_set1 (sx->disk_rows, row, 1);
return (ext_array_write (sx->disk, ofs, start, sx->default_row)
&& ext_array_write (sx->disk, ofs + start, n, data)
&& ext_array_write (sx->disk, ofs + start + n,
unsigned long int width = 0;
struct range_set *rs = range_set_create_pool (NULL);
while (next_region (pattern, start + width, &start, &width))
- range_set_insert (rs, start, width);
+ range_set_set1 (rs, start, width);
check_pattern (rs, pattern);
return rs;
}
unsigned int final_pat;
rs = make_pattern (init_pat);
- range_set_insert (rs, i, j - i);
+ range_set_set1 (rs, i, j - i);
final_pat = init_pat | bit_range (i, j - i);
check_pattern (rs, final_pat);
rs2 = range_set_clone (rs, NULL);
unsigned int final_pat;
rs = make_pattern (init_pat);
- range_set_delete (rs, i, j - i);
+ range_set_set0 (rs, i, j - i);
final_pat = init_pat & ~bit_range (i, j - i);
check_pattern (rs, final_pat);
range_set_destroy (rs);
Makes sure that this doesn't cause a double-free. */
pool = pool_create ();
rs = range_set_create_pool (pool);
- range_set_insert (rs, 1, 10);
+ range_set_set1 (rs, 1, 10);
range_set_destroy (rs);
pool_destroy (pool);
Makes sure that this doesn't cause a leak. */
pool = pool_create ();
rs = range_set_create_pool (pool);
- range_set_insert (rs, 1, 10);
+ range_set_set1 (rs, 1, 10);
pool_destroy (pool);
}