MCPcopy Create free account
hub / github.com/esnet/iperf / list_add

Function list_add

src/timer.c:60–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58
59
60static void
61list_add( Timer* t )
62{
63 Timer* t2;
64 Timer* t2prev;
65
66 if ( timers == NULL ) {
67 /* The list is empty. */
68 timers = t;
69 t->prev = t->next = NULL;
70 } else {
71 if (iperf_time_compare(&t->time, &timers->time) < 0) {
72 /* The new timer goes at the head of the list. */
73 t->prev = NULL;
74 t->next = timers;
75 timers->prev = t;
76 timers = t;
77 } else {
78 /* Walk the list to find the insertion point. */
79 for ( t2prev = timers, t2 = timers->next; t2 != NULL;
80 t2prev = t2, t2 = t2->next ) {
81 if (iperf_time_compare(&t->time, &t2->time) < 0) {
82 /* Found it. */
83 t2prev->next = t;
84 t->prev = t2prev;
85 t->next = t2;
86 t2->prev = t;
87 return;
88 }
89 }
90 /* Oops, got to the end of the list. Add to tail. */
91 t2prev->next = t;
92 t->prev = t2prev;
93 t->next = NULL;
94 }
95 }
96}
97
98
99static void

Callers 2

list_resortFunction · 0.85
tmr_createFunction · 0.85

Calls 1

iperf_time_compareFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…