seq-range-array.c revision ef174bf5299348e8c0662d235341869f319cfe54
/* Copyright (c) 2005 Timo Sirainen */
#include "lib.h"
#include "array.h"
#include "seq-range-array.h"
{
/* it's already in the range */
return TRUE;
}
} else {
}
}
return FALSE;
}
{
if (!array_is_created(array))
if (count == 0) {
return;
}
/* quick checks */
/* grow last range */
return;
}
return;
}
/* grow down first range */
return;
}
return;
}
/* somewhere in the middle, array is sorted so find it with
binary search */
return;
idx++;
/* idx == count couldn't happen because we already handle it above */
/* merge */
}
/* merge */
}
} else {
}
}
{
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;
remove_count++;
return remove_count;
/* find the beginning */
idx++;
return remove_count;
break;
}
return remove_count;
}
{
unsigned int idx;
}