9 #define ATTR_FORMAT(stringindex, firsttocheck) \
10 __attribute__((format(printf, stringindex, firsttocheck)))
12 #define ATTR_FORMAT(stringindex, firsttocheck)
15 void lognotice(char const *fmt, ...) ATTR_FORMAT(1, 2);
16 void logerror(char const *fmt, ...) ATTR_FORMAT(1, 2);
17 void fatal(char const *fmt, ...) ATTR_FORMAT(1, 2);
20 void logdebug(char const *fmt, ...) ATTR_FORMAT(1, 2);
22 static inline void logdebug(char const *fmt, ...) ATTR_FORMAT(1, 2);
23 static inline void logdebug(char const *fmt, ...) {}
27 // ___| |_ _ __ _ _ ___| |_ _ _ _ __ (_) __ _ _ _ ___ / _| __| |
28 // / __| __| '__| | | |/ __| __| | | | | '_ \| |/ _` | | | |/ _ \ | |_ / _` |
29 // \__ \ |_| | | |_| | (__| |_ | |_| | | | | | (_| | |_| | __/ | _| (_| |
30 // |___/\__|_| \__,_|\___|\__| \__,_|_| |_|_|\__, |\__,_|\___|___|_| \__,_|
34 unique_fd() = default;
35 explicit unique_fd(int f) : fd{f} {}
36 operator int() const { return fd; }
38 unique_fd(unique_fd const &) = delete;
39 unique_fd &operator=(unique_fd const &) = delete;
40 unique_fd(unique_fd &&o) : fd(o.fd) { o.fd = -1; }
41 unique_fd &operator=(unique_fd &&o) {
42 std::swap(this->fd, o.fd);
48 // ___| |_ _ __ _ _ ___| |_ | _ \ ___ | | | ___ _ __
49 // / __| __| '__| | | |/ __| __| | |_) / _ \| | |/ _ \ '__|
50 // \__ \ |_| | | |_| | (__| |_ | __/ (_) | | | __/ |
51 // |___/\__|_| \__,_|\___|\__| |_| \___/|_|_|\___|_|
54 std::vector<std::function<int(int)>> handlers;
55 std::vector<struct pollfd> pfds;
58 void add_fd(int fd, std::function<int(int)> handler);
62 #endif // !WM_UTIL_HPP