seq-range-array.c revision 199566f5a171b2c43b9a5254634f6bf47b8baca8
/* Copyright (c) 2005-2014 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "seq-range-array.h"
static bool ATTR_NOWARN_UNUSED_RESULT
{
/* it's already in the range */
return TRUE;
}
} else {
}
}
idx++;
return FALSE;
}
{
if (count == 0) {
return FALSE;
}
/* quick checks */
/* grow last range */
} else {
}
return FALSE;
}
/* grow down first range */
} else {
}
return FALSE;
}
/* somewhere in the middle, array is sorted so find it with
binary search */
return TRUE;
/* idx == count couldn't happen because we already handle it above */
/* merge */
}
} else {
idx--;
/* merge */
}
} else {
}
}
return FALSE;
}
{
if (!array_is_created(array))
}
{
idx1--;
/* no overlapping */
} else {
/* merge */
idx2--;
} else {
}
}
}
}
{
if (array_count(dest) == 0) {
return;
}
}
{
if (!array_is_created(array))
return FALSE;
if (count == 0)
return FALSE;
/* quick checks */
/* outside the range */
return FALSE;
}
/* shrink last range */
else
return TRUE;
}
/* shrink up first range */
else
return TRUE;
}
/* somewhere in the middle, array is sorted so find it with
binary search */
else {
/* found it */
/* a single sequence range.
remove it entirely */
} else {
/* shrink the range */
}
/* shrink the range */
} else {
/* split the sequence range */
}
return TRUE;
}
}
return FALSE;
}
{
/* remove first and last. this makes sure that everything between
can simply be deleted with array_delete().
FIXME: it would be faster if we did only one binary lookup here
and handled the splitting ourself.. */
remove_count++;
return remove_count;
seq1++;
remove_count++;
return remove_count;
/* find the beginning */
return remove_count;
break;
}
return remove_count;
}
{
unsigned int ret = 0;
}
return ret;
}
{
struct seq_range_iter iter;
if (count == 0)
return;
/* n points beyond array */
return;
}
/* count points beyond array */
}
}
{
for (i = 0; i < count; i++) {
}
}
(uint32_t)-1);
}
return ret;
}
{
unsigned int idx;
}
{
return TRUE;
i1++;
else
i2++;
}
return FALSE;
}
{
unsigned int seq_count = 0;
return seq_count;
}
{
unsigned int i, count;
if (array_is_created(array))
else {
count = 0;
}
if (count == 0) {
/* empty -> full */
if (!array_is_created(array))
return;
}
/* full -> empty */
return;
}
for (i = 0; i < count; ) {
} else {
i++;
}
}
}
}
{
}
{
/* iterating backwards, don't bother optimizing */
}
return TRUE;
}
}
return FALSE;
}