Skip to content

Commit

Permalink
query bed fix memory move size
Browse files Browse the repository at this point in the history
  • Loading branch information
SHI Quan committed Jun 20, 2021
1 parent 333137e commit 4ce1e5d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/bed.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ struct region_itr *bed_query(const struct bed_spec *B, char *name, int start, in
warnings("Bad ranger, %s:%d-%d", name, start, end);
return NULL;
}

int st = B->ctg[id].idx-1; // 0 based
if (end < B->bed[st].start) return NULL; // out of range

Expand All @@ -244,7 +244,7 @@ struct region_itr *bed_query(const struct bed_spec *B, char *name, int start, in
for (i = 0; i < itr->n;) {
struct bed *bed = itr->rets[i];
if (bed->start > end || bed->end < start) {
memmove(itr->rets+i, itr->rets+i+1, itr->n-i-1);
memmove(itr->rets+i, itr->rets+i+1, (itr->n-i-1)*sizeof(void*));
itr->n--;
}
else i++;
Expand Down

0 comments on commit 4ce1e5d

Please sign in to comment.