1e01f41fc6811a3ba9efc853e01a94839f7a91fb braney Thu Mar 31 09:42:58 2011 -0700 add compare routine for cBlocks based on query position diff --git src/lib/chain.c src/lib/chain.c index f756f31..a568275 100644 --- src/lib/chain.c +++ src/lib/chain.c @@ -24,30 +24,38 @@ } void chainFreeList(struct chain **pList) /* Free a list of dynamically allocated chain's */ { struct chain *el, *next; for (el = *pList; el != NULL; el = next) { next = el->next; chainFree(&el); } *pList = NULL; } +int cBlockCmpQuery(const void *va, const void *vb) +/* Compare to sort based on query start. */ +{ +const struct cBlock *a = *((struct cBlock **)va); +const struct cBlock *b = *((struct cBlock **)vb); +return a->qStart - b->qStart; +} + int cBlockCmpTarget(const void *va, const void *vb) /* Compare to sort based on target start. */ { const struct cBlock *a = *((struct cBlock **)va); const struct cBlock *b = *((struct cBlock **)vb); return a->tStart - b->tStart; } int cBlockCmpBoth(const void *va, const void *vb) /* Compare to sort based on query, then target. */ { const struct cBlock *a = *((struct cBlock **)va); const struct cBlock *b = *((struct cBlock **)vb); int dif; dif = a->qStart - b->qStart;