LCOV - code coverage report
Current view: top level - src/protocol2 - blist.c (source / functions) Hit Total Coverage
Test: burp-coverage-clean.info Lines: 25 25 100.0 %
Date: 2019-03-30 01:11:57 Functions: 3 3 100.0 %

          Line data    Source code
       1             : #include "../burp.h"
       2             : #include "blist.h"
       3             : #include "blk.h"
       4             : #include "../alloc.h"
       5             : 
       6         329 : struct blist *blist_alloc(void)
       7             : {
       8         329 :         return (struct blist *)calloc_w(1, sizeof(struct blist), __func__);
       9             : }
      10             : 
      11         699 : void blist_free(struct blist **blist)
      12             : {
      13             :         struct blk *b;
      14             :         struct blk *head;
      15        1069 :         if(!blist || !*blist) return;
      16         329 :         b=(*blist)->head;
      17         329 :         head=b;
      18      203165 :         while(head)
      19             :         {
      20      202507 :                 b=head;
      21      202507 :                 head=head->next;
      22      202507 :                 blk_free(&b);
      23             :         }
      24         329 :         free_v((void **)blist);
      25             : }
      26             : 
      27      227581 : void blist_add_blk(struct blist *blist, struct blk *blk)
      28             : {
      29      227581 :         blk->index=++(blist->last_index);
      30             : 
      31      227581 :         if(blist->tail)
      32             :         {
      33             :                 // Add to the end of the list.
      34      227456 :                 blist->tail->next=blk;
      35      227456 :                 blist->tail=blk;
      36             :                 // Markers might have fallen off the end. Start them again
      37             :                 // on the tail.
      38      227456 :                 if(!blist->last_requested) blist->last_requested=blist->tail;
      39      227456 :                 if(!blist->last_sent) blist->last_sent=blist->tail;
      40             :                 return;
      41             :         }
      42             : 
      43             :         // Start the list.
      44         125 :         blist->head=blk;
      45         125 :         blist->tail=blk;
      46             :         // Pointers to the head that can move along the list
      47             :         // at a different rate.
      48         125 :         blist->blk_for_champ_chooser=NULL;
      49         125 :         blist->blk_from_champ_chooser=blk;
      50         125 :         blist->last_requested=blk;
      51         125 :         blist->last_sent=blk;
      52         125 :         blist->blk_to_dedup=blk;
      53             : }

Generated by: LCOV version 1.13