From db0c83d744a4d3e2598c5c9dc73f7bc6a5b08ad6 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Fri, 16 Dec 2022 10:33:45 +0100 Subject: [PATCH] ev::close: shim over unregister Reduce code duplication --- ev/+linux/file.ha | 9 +++------ diff --git a/ev/+linux/file.ha b/ev/+linux/file.ha index fc417361aa743afbf739a1c2b94a2d5db00fbee0..e0d5044082a9ec6c398db5e427a03e3945c9e0b6 100644 --- a/ev/+linux/file.ha +++ b/ev/+linux/file.ha @@ -83,12 +83,9 @@ // Unregisters a file object with an event loop, frees resources associated with // it, and closes the underlying file descriptor. export fn close(file: *file) void = { - const loop = file.ev; - if (file.flags & fflags::BLOCKING == 0) { - rt::epoll_ctl(loop.fd, rt::EPOLL_CTL_DEL, file.fd, null)!; - }; - io::close(file.fd)!; - free(file); + const fd = file.fd; + unregister(file); + io::close(fd)!; }; // Sets the user data field on this file object to the provided object. -- 2.48.1