Skip to content

Commit

Permalink
fix: remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
Zxilly committed Jun 30, 2024
1 parent e1da571 commit 8aeec0a
Showing 1 changed file with 3 additions and 37 deletions.
40 changes: 3 additions & 37 deletions src/ua2f.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ void main_loop(struct nf_queue *queue) {
break;
}
}

free(buf->data);
}

int main(const int argc, char *argv[]) {
Expand Down Expand Up @@ -88,44 +90,8 @@ int main(const int argc, char *argv[]) {
return EXIT_FAILURE;
}

while (!should_exit) {
const __auto_type buf_status = nfqueue_receive(queue, buf, 0);
switch (buf_status) {
case IO_ERROR:
should_exit = true;
break;
case IO_NOTREADY:
continue;
case IO_READY:
while (!should_exit) {
struct nf_packet packet[1];
switch (nfqueue_next(buf, packet)) {
case IO_ERROR:
should_exit = true;
break;
case IO_READY:
handle_packet(queue, packet);
break;
case IO_NOTREADY:
// we've read every packet in the buffer
break;
default:
// we should never reach this point
syslog(LOG_ERR, "Unknown return value [%s:%d]", __FILE__, __LINE__);
should_exit = true;
break;
}
}
break;
default:
// we should never reach this point
syslog(LOG_ERR, "Unknown return value [%s:%d]", __FILE__, __LINE__);
should_exit = true;
break;
}
}
main_loop(queue);

free(buf->data);
nfqueue_close(queue);

return EXIT_SUCCESS;
Expand Down

0 comments on commit 8aeec0a

Please sign in to comment.