refine code

This commit is contained in:
5ec1cff
2024-01-05 13:41:40 +08:00
parent ad32c4efb0
commit 675febfd14
4 changed files with 54 additions and 50 deletions

View File

@@ -94,7 +94,7 @@ public:
return true;
}
bool UnregisterHandler(EventHandler &handler) {
[[maybe_unused]] bool UnregisterHandler(EventHandler &handler) {
if (epoll_ctl(epoll_fd_, EPOLL_CTL_DEL, handler.GetFd(), nullptr) == -1) {
PLOGE("failed to del event handler");
return false;
@@ -149,7 +149,7 @@ struct SocketHandler : public EventHandler {
return sock_fd_;
}
void HandleEvent(EventLoop &loop, uint32_t event) override {
void HandleEvent(EventLoop &loop, uint32_t) override {
struct [[gnu::packed]] MsgHead {
Command cmd;
int length;
@@ -346,7 +346,7 @@ public:
return signal_fd_;
}
void HandleEvent(EventLoop &loop, uint32_t event) override {
void HandleEvent(EventLoop &, uint32_t) override {
for (;;) {
ssize_t s = read(signal_fd_, &fdsi, sizeof(fdsi));
if (s == -1) {
@@ -602,7 +602,7 @@ void send_control_command(Command cmd) {
if (nsend == -1) {
err(EXIT_FAILURE, "send");
} else if (nsend != sizeof(cmd)) {
printf("send %ld != %ld\n", nsend, sizeof(cmd));
printf("send %zu != %zu\n", nsend, sizeof(cmd));
exit(1);
}
printf("command sent\n");