summaryrefslogtreecommitdiff
path: root/src/utils.h
blob: ec1b4dbd9635c97a4a3d3438fa58b123253dc1d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef _TTF2F_UTILS_H_
#define _TTF2F_UTILS_H_

#ifndef UNUSED
#define UNUSED(x) ((x)=(x))
#endif

#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif

#ifndef min
#define min(a,b) (((a) > (b)) ? (b) : (a))
#endif

#ifndef N_ELEMENTS
#define N_ELEMENTS(x) (sizeof((x)) / sizeof((x)[0]))
#endif

typedef enum ttf2f_result {
	TTF2F_RESULT_OK,
	TTF2F_RESULT_NOMEM,
	TTF2F_RESULT_OPEN,
	TTF2F_RESULT_WRITE
} ttf2f_result;

void ttf2f_poll(int active);
char *strndup(const char *s, size_t n);
long convert_units(long raw, long ppem);

#endif