mirror of
https://github.com/mintycube/dmenu.git
synced 2024-10-22 14:05:48 +02:00
76549d014e
1. use `unsigned int` to store the codepoints, this avoids waste on common case where `long` is 64bits. and POSIX guarantees `int` to be at least 32bits so there's no risk of truncation. 2. since switching to `unsigned int` cuts down the memory requirement by half, double the cache size from 64 to 128. 3. instead of a linear search, use a simple hash-table for O(1) lookups. ref. https://git.suckless.org/dmenu/commit/7ab0cb5ef0e19352fc5d64ae0d57a5cf4540acbf.html
14 lines
404 B
C
14 lines
404 B
C
/* See LICENSE file for copyright and license details. */
|
|
|
|
#ifndef MAX
|
|
#define MAX(A, B) ((A) > (B) ? (A) : (B))
|
|
#endif
|
|
#ifndef MIN
|
|
#define MIN(A, B) ((A) < (B) ? (A) : (B))
|
|
#endif
|
|
#define BETWEEN(X, A, B) ((A) <= (X) && (X) <= (B))
|
|
#define LENGTH(X) (sizeof (X) / sizeof (X)[0])
|
|
|
|
void die(const char *fmt, ...);
|
|
void *ecalloc(size_t nmemb, size_t size);
|