Skip to content

Commit 5b47279

Browse files
committed
Reformat code base with clang-format-4.0.
* To make reformatting reproducible `make reformat` was used. Signed-off-by: Victor Toni <[email protected]>
1 parent 020c75c commit 5b47279

22 files changed

+907
-1027
lines changed

src/callout.c

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,18 @@
3232
**
3333
*/
3434

35-
3635
#include "igmpproxy.h"
3736

3837
/* the code below implements a callout queue */
3938
static int id = 0;
40-
static struct timeOutQueue *queue = 0; /* pointer to the beginning of timeout queue */
39+
static struct timeOutQueue *queue = 0; /* pointer to the beginning of timeout queue */
4140

4241
struct timeOutQueue {
43-
struct timeOutQueue *next; // Next event in queue
44-
int id;
45-
timer_f func; // function to call
46-
void *data; // Data for function
47-
int time; // Time offset for next event
42+
struct timeOutQueue *next; // Next event in queue
43+
int id;
44+
timer_f func; // function to call
45+
void *data; // Data for function
46+
int time; // Time offset for next event
4847
};
4948

5049
// Method for dumping the Queue to the log.
@@ -70,7 +69,6 @@ void free_all_callouts(void) {
7069
}
7170
}
7271

73-
7472
/**
7573
* elapsed_time seconds have passed; perform all the events that should
7674
* happen.
@@ -90,7 +88,7 @@ void age_callout_queue(int elapsed_time) {
9088
if (_queue == NULL)
9189
_queue = ptr;
9290
last = ptr;
93-
}
91+
}
9492
}
9593

9694
queue = ptr;
@@ -103,7 +101,7 @@ void age_callout_queue(int elapsed_time) {
103101
_queue = _queue->next;
104102
my_log(LOG_DEBUG, 0, "About to call timeout %d (#%d)", ptr->id, i);
105103
if (ptr->func)
106-
ptr->func(ptr->data);
104+
ptr->func(ptr->data);
107105
free(ptr);
108106
}
109107
}
@@ -115,8 +113,7 @@ void age_callout_queue(int elapsed_time) {
115113
int timer_nextTimer(void) {
116114
if (queue) {
117115
if (queue->time < 0) {
118-
my_log(LOG_WARNING, 0, "timer_nextTimer top of queue says %d",
119-
queue->time);
116+
my_log(LOG_WARNING, 0, "timer_nextTimer top of queue says %d", queue->time);
120117
return 0;
121118
}
122119
return queue->time;
@@ -131,7 +128,7 @@ int timer_nextTimer(void) {
131128
* @param data - Pointer to the function data to supply...
132129
*/
133130
int timer_setTimer(int delay, timer_f action, void *data) {
134-
struct timeOutQueue *ptr, *node, *prev;
131+
struct timeOutQueue *ptr, *node, *prev;
135132
int i = 0;
136133

137134
/* create a node */
@@ -144,7 +141,7 @@ int timer_setTimer(int delay, timer_f action, void *data) {
144141
node->data = data;
145142
node->time = delay;
146143
node->next = 0;
147-
node->id = ++id;
144+
node->id = ++id;
148145

149146
prev = ptr = queue;
150147

@@ -153,37 +150,33 @@ int timer_setTimer(int delay, timer_f action, void *data) {
153150
/* if the queue is empty, insert the node and return */
154151
if (!queue) {
155152
queue = node;
156-
}
157-
else {
153+
} else {
158154
/* chase the pointer looking for the right place */
159155
while (ptr) {
160156
if (delay < ptr->time) {
161157
// We found the correct node
162158
node->next = ptr;
163159
if (ptr == queue) {
164160
queue = node;
165-
}
166-
else {
161+
} else {
167162
prev->next = node;
168163
}
169164
ptr->time -= node->time;
170-
my_log(LOG_DEBUG, 0,
171-
"Created timeout %d (#%d) - delay %d secs",
172-
node->id, i, node->time);
165+
my_log(LOG_DEBUG, 0, "Created timeout %d (#%d) - delay %d secs", node->id, i, node->time);
173166
debugQueue();
174167
return node->id;
175168
} else {
176169
// Continur to check nodes.
177-
delay -= ptr->time; node->time = delay;
170+
delay -= ptr->time;
171+
node->time = delay;
178172
prev = ptr;
179173
ptr = ptr->next;
180174
}
181175
i++;
182176
}
183177
prev->next = node;
184178
}
185-
my_log(LOG_DEBUG, 0, "Created timeout %d (#%d) - delay %d secs",
186-
node->id, i, node->time);
179+
my_log(LOG_DEBUG, 0, "Created timeout %d (#%d) - delay %d secs", node->id, i, node->time);
187180
debugQueue();
188181

189182
return node->id;
@@ -211,8 +204,8 @@ int timer_leftTimer(int timer_id) {
211204
/**
212205
* clears the associated timer. Returns 1 if succeeded.
213206
*/
214-
int timer_clearTimer(int timer_id) {
215-
struct timeOutQueue *ptr, *prev;
207+
int timer_clearTimer(int timer_id) {
208+
struct timeOutQueue *ptr, *prev;
216209
int i = 0;
217210

218211
if (!timer_id)
@@ -261,7 +254,7 @@ int timer_clearTimer(int timer_id) {
261254
* debugging utility
262255
*/
263256
static void debugQueue(void) {
264-
struct timeOutQueue *ptr;
257+
struct timeOutQueue *ptr;
265258

266259
for (ptr = queue; ptr; ptr = ptr->next) {
267260
my_log(LOG_DEBUG, 0, "(Id:%d, Time:%d) ", ptr->id, ptr->time);

0 commit comments

Comments
 (0)