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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
#ifndef LIBDTOVERLAY_SYSDEPS_H
#define LIBDTOVERLAY_SYSDEPS_H
/* Change these includes to match your platform to bring in the
* equivalent types available in a normal C runtime. At least things
* like uint8_t, uint64_t, and bool (with |false|, |true| keywords)
* must be present.
*/
#include <inttypes.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#ifdef DTO_ENABLE_DEBUG
/* Print functions, used for diagnostics.
*
* These have no effect unless FDT_ENABLE_DEBUG is defined.
*/
#define dto_debug(...) \
do { \
dto_print("DEBUG: %s():", __func__); \
dto_print(__VA_ARGS__); \
} while (0)
#else
#define dto_debug(...)
#endif
#define dto_error(...) \
do { \
dto_print("ERROR: %s():", __func__); \
dto_print(__VA_ARGS__); \
} while (0)
int dto_print(const char *fmt, ...);
void dto_qsort(void *base, size_t nmemb, size_t size,
int (*compar)(const void *, const void *));
void *dto_malloc(size_t size);
void dto_free(void *ptr);
char *dto_strdup(const char *s);
char *dto_strchr(const char *s, int c);
unsigned long int dto_strtoul(const char *nptr, char **endptr, int base);
size_t dto_strlen(const char *s);
void *dto_memcpy(void *dest, const void *src, size_t n);
int dto_strcmp(const char *s1, const char *s2);
int dto_strncmp(const char *s1, const char *s2, size_t n);
void *dto_memchr(const void *s, int c, size_t n);
void *dto_memset(void *s, int c, size_t n);
#endif /* LIBDTOVERLAY_SYSDEPS_H */
|