28 return (Pvoid_t) NULL;
40 int *contains_saveptr) {
42 Word_t loosest_len = 0;
50 *contains_saveptr = 0;
52 for (i = 0; i < array_list_len(crdlist); ++
i) {
59 *contains_saveptr = 1;
68 int *contains_saveptr) {
70 Word_t tightest_len = ULONG_MAX;
71 Word_t tightest_containing_len = ULONG_MAX;
77 *contains_saveptr = 0;
82 for (i = 0; i < array_list_len(crdlist); ++
i) {
89 < tightest_containing_len) {
91 *contains_saveptr = 1;
92 best_containing_crd = crd;
98 if (best_containing_crd)
99 return best_containing_crd;
115 verror(
"end 0x%lx < start 0x%lx; not adding!\n",end,start);
131 alist = array_list_create(1);
158 if (pv && pv != PJERR) {
164 verror(
"no crd containing range(0x%lx,0x%lx)!\n",start,end);
188 "containing range for (0x%lx,0x%lx) is (0x%lx,0x%lx)\n",
193 "no containing range for (0x%lx,0x%lx) (%d)!\n",
197 else if (pv == PJERR)
209 array_list_append(alist,crd);
215 array_list_free(alist);
240 for (i = 0; i < array_list_len(alist); ++
i) {
244 "updated alist %p crd %p start %lx end %lx (old end %lx)"
245 " i %d data %p\n",alist,crd,start,end,
CLRANGE_END(crd),i,data);
273 if (!pv || pv == PJERR)
277 for (i = 0; i < array_list_len(alist); ++
i) {
317 Word_t lrlen = ~(Word_t)0;
343 for (i = array_list_len(alist) - 1; i > -1; --
i) {
345 array_list_item(alist,i);
394 if (pv == NULL || pv == PJERR)
405 verror(
"did not find a tightest range for 0x%lx even though we should have!\n",index);
512 Word_t idx_end = index +
len;
514 Word_t idx = idx_end;
521 retval = array_list_create(1);
535 for (i = array_list_len(alist) - 1; i >= 0; --
i) {
538 array_list_append(retval,crd);
544 verror(
"CRD array list empty, but not NULL!\n");
561 if (array_list_len(retval) == 0) {
562 array_list_free(retval);
568 array_list_free(retval);
587 array_list_deep_free((
struct array_list *)*pv);
596 JLFA(bytes_freed,clf);
602 Word_t index,nextindex;
622 nextindex = index + 1;
649 return (Pvoid_t)NULL;
658 verror(
"end 0x%lx < start 0x%lx; not adding!\n",end,start);
672 if (start == crd->
start
673 || (start >= crd->
start && start < crd->end)
674 || (end > crd->
start && end <= crd->
end))
685 if (start == crd->
start)
687 if (start >= crd->
start && start < crd->end)
689 if (end > crd->
start && end <= crd->end)
727 if (index < crd->start || index >= crd->
end)
754 if (index == crd->
start) {
833 JLFA(bytes_freed,clr);
837 return (Pvoid_t) NULL;
854 alist = array_list_create(1);
862 else if (pv == PJERR)
867 array_list_append(alist,data);
873 array_list_free(alist);
921 JLFA(bytes_freed,clf);
925 return (Pvoid_t) NULL;
947 else if (pv == PJERR)
966 else if (pv == PJERR)
1004 JLFA(bytes_freed,clf);
int clmatch_add(clmatch_t *clf, Word_t index, void *data)
int clmatchone_add(clmatchone_t *clf, Word_t index, void *data)
struct clf_range_data * crd_get_loosest(struct array_list *crdlist, Word_t start, Word_t end, int *contains_saveptr)
static uint64_t unsigned int i
void clmatch_free(clmatch_t clf)
clrange_t clrange_create()
clmatchone_t clmatchone_create()
clrangesimple_t clrangesimple_create(void)
struct array_list * clrange_find_prev_inc(clrange_t *clf, Word_t index)
#define verror(format,...)
struct clf_range_data * crd_top_containing_range(struct clf_range_data *crd)
int clrangesimple_add(clrangesimple_t *clr, Word_t start, Word_t end, void *data)
void clrange_free(clmatch_t clf)
#define array_list_foreach(alist, lpc, placeholder)
void clrangesimple_free(clrangesimple_t clr, clrangesimple_free_dtor dtor, void *dtor_data)
int clrange_update_end(clrange_t *clf, Word_t start, Word_t end, void *data)
struct clf_range_data * clrange_find_loosest(clrange_t *clf, Word_t index, struct array_list **al_saveptr)
#define CLRANGE_DATA(crd)
void clrange_dump(clrange_t *clf, struct dump_info *ud, clrange_dumper_t dumper)
struct clf_range_data * crd_get_tightest(struct array_list *crdlist, Word_t start, Word_t end, int *contains_saveptr)
void * clmatchone_find(clmatchone_t *clf, Word_t index, Word_t *o_index)
struct clf_range_data * containing_range
#define vdebug(devel, areas, flags, format,...)
struct array_list * clrange_find_prev_exc(clrange_t *clf, Word_t index)
int clrangesimple_find(clrangesimple_t *clr, Word_t index, Word_t *start, Word_t *end, void **data)
#define CLRANGE_START(crd)
struct array_list * clmatch_find(clmatch_t *clf, Word_t index)
void(* clrange_dumper_t)(Word_t start, Word_t end, struct dump_info *ud, void *data)
struct array_list * clrange_find_next_inc(clrange_t *clf, Word_t index)
int clmatchone_update(clmatchone_t *clf, Word_t index, void *data)
int(* clrangesimple_foreach_handler)(Word_t start, Word_t end, void *data, void *hpriv)
int clrangesimple_remove(clrangesimple_t *clr, Word_t index, Word_t *end, void **data)
struct clf_range_data * clrange_find_next_loosest(clrange_t *clf, Word_t index, struct array_list **al_saveptr)
void(* clrangesimple_free_dtor)(Word_t start, Word_t end, void *data, void *dtor_data)
struct array_list * clrange_find_next_exc(clrange_t *clf, Word_t index)
clmatch_t clmatch_create()
void * malloc(size_t size)
struct array_list * clrange_find_subranges_inside(clrange_t *clf, Word_t index, unsigned int len)
int clrangesimple_foreach(clrangesimple_t clr, clrangesimple_foreach_handler handler, void *hpriv)
int clrange_add(clrange_t *clf, Word_t start, Word_t end, void *data)
void * clrange_find(clrange_t *clf, Word_t index)
void clmatchone_free(clmatchone_t clf)