9 #define ATTR_FORMAT(stringindex, firsttocheck) __attribute__((format(printf, stringindex, firsttocheck)))
11 #define ATTR_FORMAT(stringindex, firsttocheck)
14 void lognotice(char const *fmt, ...) ATTR_FORMAT(1,2);
15 void logerror(char const *fmt, ...) ATTR_FORMAT(1,2);
16 void fatal(char const *fmt, ...) ATTR_FORMAT(1,2);
19 void logdebug(char const *fmt, ...) ATTR_FORMAT(1,2);
21 static inline void logdebug(char const * fmt, ...) ATTR_FORMAT(1,2);
22 static inline void logdebug(char const * fmt, ...) {}
26 // ___| |_ _ __ _ _ ___| |_ _ _ _ __ (_) __ _ _ _ ___ / _| __| |
27 // / __| __| '__| | | |/ __| __| | | | | '_ \| |/ _` | | | |/ _ \ | |_ / _` |
28 // \__ \ |_| | | |_| | (__| |_ | |_| | | | | | (_| | |_| | __/ | _| (_| |
29 // |___/\__|_| \__,_|\___|\__| \__,_|_| |_|_|\__, |\__,_|\___|___|_| \__,_|
33 unique_fd() = default;
34 explicit unique_fd(int f) : fd{f} {}
35 operator int() const { return fd; }
37 unique_fd(unique_fd const &) = delete;
38 unique_fd &operator=(unique_fd const &) = delete;
39 unique_fd(unique_fd &&o) : fd(o.fd) { o.fd = -1; }
40 unique_fd &operator=(unique_fd &&o) {
41 std::swap(this->fd, o.fd);
47 // ___| |_ _ __ _ _ ___| |_ | _ \ ___ | | | ___ _ __
48 // / __| __| '__| | | |/ __| __| | |_) / _ \| | |/ _ \ '__|
49 // \__ \ |_| | | |_| | (__| |_ | __/ (_) | | | __/ |
50 // |___/\__|_| \__,_|\___|\__| |_| \___/|_|_|\___|_|
53 std::vector<std::function<int(int)>> handlers;
54 std::vector<struct pollfd> pfds;
57 void add_fd(int fd, std::function<int(int)> handler);
61 #endif // !WM_UTIL_HPP