Miscellaneous cleanup

This commit is contained in:
Sanchayan Maity 2016-03-19 17:42:29 +05:30
parent 0cc443d3c2
commit d84b3d9248
1 changed files with 3 additions and 11 deletions

View File

@ -157,14 +157,6 @@ size_t mq_receive(mqd_t mqdes, char *msg_ptr, unsigned int msg_prio, endpoint_t
return 0;
}
int find_max(int n1, int n2)
{
if (n1 > n2)
return n1;
return n2;
}
int message_index_with_highprio(int mqdes, endpoint_t dst)
{
int prio;
@ -179,9 +171,9 @@ int message_index_with_highprio(int mqdes, endpoint_t dst)
if (max_prio == prio) {
if (mq.msg[mqdes].msge[i].timestamp > mq.msg[mqdes].msge[index].timestamp)
index = i;
} else if (max_prio < find_max(max_prio, prio)) {
} else if (max_prio < MAX(max_prio, prio)) {
index = i;
max_prio = find_max(max_prio, prio);
max_prio = MAX(max_prio, prio);
}
}
}
@ -202,7 +194,7 @@ int clean_message_queue(mqd_t mqdes)
flag = 0;
}
if (flag == 1) {
if (flag) {
mq.msg[mqdes].msg_slot_empty[i] = EMPTY;
mq.msg[mqdes].num_msgs--;
}