Rewrite the entire code-base
The following changes are focused upon: - Modularity - Doing away with globals - No heap allocations - Better command line interface - Switch from Xlib to XCB - More verbose type definitions - Implement a single-file config by utilising X-macros
This commit is contained in:
22
include/util.h
Normal file
22
include/util.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||
#define LEN(arr) (sizeof(arr) / sizeof(arr[0]))
|
||||
#define BIT(n) (1 << (n))
|
||||
#define MEMBER_SIZE(type, member) sizeof(((type*)NULL)->member)
|
||||
#define MEMBER_LENGTH(type, member) \
|
||||
(MEMBER_SIZE(type, member) / MEMBER_SIZE(type, member[0]))
|
||||
|
||||
#define UTF8_MAX_BYTE_COUNT 4
|
||||
|
||||
enum pipe_fd_index {
|
||||
READ_END,
|
||||
WRITE_END,
|
||||
PIPE_FD_COUNT,
|
||||
};
|
||||
|
||||
unsigned int gcd(unsigned int a, unsigned int b);
|
||||
size_t truncate_utf8_string(char* const buffer, const size_t size,
|
||||
const size_t char_limit);
|
||||
Reference in New Issue
Block a user