OpenCoverage

i-ring.c

Absolute File Name:/home/opencoverage/opencoverage/guest-scripts/coreutils/src/gnulib/lib/i-ring.c
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4void-
5i_ring_init (I_ring *ir, int default_val)-
6{-
7 int i;-
8 ir->ir_empty = -
9 1-
10 ;-
11 ir->ir_front = 0;-
12 ir->ir_back = 0;-
13 for (i = 0; i < I_RING_SIZE
i < I_RING_SIZEDescription
TRUEevaluated 27280 times by 6 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • du
  • mv
  • rm
FALSEevaluated 6820 times by 6 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • du
  • mv
  • rm
; i++)
6820-27280
14 ir->ir_data[i] = default_val;
executed 27280 times by 6 tests: ir->ir_data[i] = default_val;
Executed by:
  • chgrp
  • chmod
  • chown
  • du
  • mv
  • rm
27280
15 ir->ir_default_val = default_val;-
16}
executed 6820 times by 6 tests: end of block
Executed by:
  • chgrp
  • chmod
  • chown
  • du
  • mv
  • rm
6820
17-
18-
19_Bool-
20-
21i_ring_empty (I_ring const *ir)-
22{-
23 return
executed 152919 times by 6 tests: return ir->ir_empty;
Executed by:
  • chgrp
  • chmod
  • chown
  • du
  • mv
  • rm
ir->ir_empty;
executed 152919 times by 6 tests: return ir->ir_empty;
Executed by:
  • chgrp
  • chmod
  • chown
  • du
  • mv
  • rm
152919
24}-
25-
26int-
27i_ring_push (I_ring *ir, int val)-
28{-
29 unsigned int dest_idx = (ir->ir_front + !ir->ir_empty) % I_RING_SIZE;-
30 int old_val = ir->ir_data[dest_idx];-
31 ir->ir_data[dest_idx] = val;-
32 ir->ir_front = dest_idx;-
33 if (dest_idx == ir->ir_back
dest_idx == ir->ir_backDescription
TRUEevaluated 27174 times by 6 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • du
  • mv
  • rm
FALSEevaluated 46604 times by 6 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • du
  • mv
  • rm
)
27174-46604
34 ir->ir_back = (ir->ir_back + !ir->ir_empty) % I_RING_SIZE;
executed 27174 times by 6 tests: ir->ir_back = (ir->ir_back + !ir->ir_empty) % I_RING_SIZE;
Executed by:
  • chgrp
  • chmod
  • chown
  • du
  • mv
  • rm
27174
35 ir->ir_empty = -
36 0-
37 ;-
38 return
executed 73778 times by 6 tests: return old_val;
Executed by:
  • chgrp
  • chmod
  • chown
  • du
  • mv
  • rm
old_val;
executed 73778 times by 6 tests: return old_val;
Executed by:
  • chgrp
  • chmod
  • chown
  • du
  • mv
  • rm
73778
39}-
40-
41int-
42i_ring_pop (I_ring *ir)-
43{-
44 int top_val;-
45 if (i_ring_empty (ir)
i_ring_empty (ir)Description
TRUEnever evaluated
FALSEevaluated 59567 times by 6 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • du
  • mv
  • rm
)
0-59567
46 abort ();
never executed: abort ();
0
47 top_val = ir->ir_data[ir->ir_front];-
48 ir->ir_data[ir->ir_front] = ir->ir_default_val;-
49 if (ir->ir_front == ir->ir_back
ir->ir_front == ir->ir_backDescription
TRUEevaluated 12963 times by 6 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • du
  • mv
  • rm
FALSEevaluated 46604 times by 6 tests
Evaluated by:
  • chgrp
  • chmod
  • chown
  • du
  • mv
  • rm
)
12963-46604
50 ir->ir_empty =
executed 12963 times by 6 tests: ir->ir_empty = 1 ;
Executed by:
  • chgrp
  • chmod
  • chown
  • du
  • mv
  • rm
12963
51 1
executed 12963 times by 6 tests: ir->ir_empty = 1 ;
Executed by:
  • chgrp
  • chmod
  • chown
  • du
  • mv
  • rm
12963
52 ;
executed 12963 times by 6 tests: ir->ir_empty = 1 ;
Executed by:
  • chgrp
  • chmod
  • chown
  • du
  • mv
  • rm
12963
53 else-
54 ir->ir_front = ((ir->ir_front + I_RING_SIZE - 1) % I_RING_SIZE);
executed 46604 times by 6 tests: ir->ir_front = ((ir->ir_front + I_RING_SIZE - 1) % I_RING_SIZE);
Executed by:
  • chgrp
  • chmod
  • chown
  • du
  • mv
  • rm
46604
55 return
executed 59567 times by 6 tests: return top_val;
Executed by:
  • chgrp
  • chmod
  • chown
  • du
  • mv
  • rm
top_val;
executed 59567 times by 6 tests: return top_val;
Executed by:
  • chgrp
  • chmod
  • chown
  • du
  • mv
  • rm
59567
56}-
Switch to Source codePreprocessed file

Generated by Squish Coco 4.1.2