diff --git a/src/hstr_history.c b/src/hstr_history.c index 1ba72e7..6a9e329 100644 --- a/src/hstr_history.c +++ b/src/hstr_history.c @@ -8,6 +8,7 @@ */ #include +#include #include #include "include/hstr_history.h" @@ -30,7 +31,11 @@ static const char *commandBlacklist[] = {"ls", "pwd", "cd", "hh", "mc"}; #define DEBUG_RADIXSORT() #endif -#define HISTORY_RANKING_FUNCTION(RANK,NEWOCCURENCEORDER,LNG) RANK+NEWOCCURENCEORDER/10+LNG +unsigned history_ranking_function(unsigned rank, int newOccurenceOrder, size_t length) { + long metrics=rank+newOccurenceOrder/10+length; + assert(metricsrank=HISTORY_RANKING_FUNCTION(0, i, strlen(line)); + r->rank=history_ranking_function(0, i, strlen(line)); r->item=historyList[i]->line; hashset_put(&rankmap, line, r); @@ -112,7 +117,7 @@ HistoryItems *get_prioritized_history() assert(radixItem); if(radixItem) { - r->rank=HISTORY_RANKING_FUNCTION(r->rank, i, strlen(line)); + r->rank=history_ranking_function(r->rank, i, strlen(line)); radixItem->key=r->rank; radixsort_add(&rs, radixItem); } diff --git a/src/radixsort.c b/src/radixsort.c index 7bf6e09..4dfb0b3 100644 --- a/src/radixsort.c +++ b/src/radixsort.c @@ -45,7 +45,6 @@ void radixsort_add(RadixSorter *rs, RadixItem *item) unsigned topIndex = GET_TOP_INDEX(item->key); unsigned lowIndex = GET_LOW_INDEX(item->key); - if(!rs->topDigits[topIndex]) { rs->topDigits[topIndex]=radixsort_get_slot(rs, topIndex); }