X-Git-Url: https://arthur.barton.de/gitweb/?a=blobdiff_plain;f=src%2Fadaptive_resortable_list.c;h=f74c53eae5e192845ae57ed7975eb3ee9d8d5034;hb=b060bae83cc36fdc4f14120228e4c9b0d1ec42e8;hp=ac525dc6c14b3fadb418a7a3e9ab442c50821625;hpb=884d7b38d87443b477a710bed6b2c15137a1e0f5;p=netdata.git diff --git a/src/adaptive_resortable_list.c b/src/adaptive_resortable_list.c index ac525dc6..f74c53ea 100644 --- a/src/adaptive_resortable_list.c +++ b/src/adaptive_resortable_list.c @@ -65,6 +65,7 @@ void arl_begin(ARL_BASE *base) { info("ARL '%s' has %zu fast searches and %zu slow searches. Is the source really changing so fast?" , base->name, base->fast, base->slow); + /* if(unlikely(base->iteration % 60 == 0)) { info("ARL '%s' statistics: iteration %zu, expected %zu, wanted %zu, allocated %zu, fred %zu, relinkings %zu, found %zu, added %zu, fast %zu, slow %zu" , base->name @@ -82,6 +83,7 @@ void arl_begin(ARL_BASE *base) { // for(e = base->head; e; e = e->next) fprintf(stderr, "%s ", e->name); // fprintf(stderr, "\n"); } + */ } #endif @@ -231,9 +233,14 @@ int arl_find_or_create_and_relink(ARL_BASE *base, const char *s, const char *val if(base->head == base->next_keyword) base->head = e; } - else + else { e->prev = NULL; + if(!base->head) + base->head = e; + } + + // prepare the next iteration base->next_keyword = e->next; if(unlikely(!base->next_keyword)) base->next_keyword = base->head;