defs.h | defs.h | |||
---|---|---|---|---|
skipping to change at line 142 | skipping to change at line 142 | |||
# ifndef offsetof | # ifndef offsetof | |||
# define offsetof(type, member) \ | # define offsetof(type, member) \ | |||
reinterpret_cast(long, &(static_cast(type *, NULL)-> member)) | reinterpret_cast(long, &(static_cast(type *, NULL)-> member)) | |||
# endif | # endif | |||
# ifndef containerof | # ifndef containerof | |||
# define containerof(var, type, member) reinterpret_cast(type *, \ | # define containerof(var, type, member) reinterpret_cast(type *, \ | |||
reinterpret_cast(char *, var) - offsetof(type, membe r)) | reinterpret_cast(char *, var) - offsetof(type, membe r)) | |||
# endif | # endif | |||
#endif | #endif | |||
#if defined(__GNUC__) && !defined(__cplusplus) | ||||
# define __array_size_check(a) BUILD_BUG_ON_EXPR(\ | ||||
__builtin_types_compatible_p(__typeof__(a), __typeof__(&*(a) | ||||
))) | ||||
#else | ||||
# define __array_size_check(a) 0 | ||||
#endif | ||||
#ifndef ARRAY_SIZE | #ifndef ARRAY_SIZE | |||
# define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x))) | # define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x)) + __array_size_check( | |||
x)) | ||||
#endif | ||||
#ifndef BUILD_BUG_ON_EXPR | ||||
# define BUILD_BUG_ON_EXPR(condition) (sizeof(char[1 - 2 * !!(conditio | ||||
n)])) | ||||
#endif | #endif | |||
#ifndef BUILD_BUG_ON | #ifndef BUILD_BUG_ON | |||
# define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2 * !!(conditi on)])) | # define BUILD_BUG_ON(condition) ((void)BUILD_BUG_ON_EXPR(condition)) | |||
#endif | #endif | |||
#ifndef O_BINARY | #ifndef O_BINARY | |||
# define O_BINARY 0 | # define O_BINARY 0 | |||
#endif | #endif | |||
#ifndef S_IRUGO | #ifndef S_IRUGO | |||
# define S_IRUGO (S_IRUSR | S_IRGRP | S_IROTH) | # define S_IRUGO (S_IRUSR | S_IRGRP | S_IROTH) | |||
#endif | #endif | |||
#ifndef S_IWUGO | #ifndef S_IWUGO | |||
# define S_IWUGO (S_IWUSR | S_IWGRP | S_IWOTH) | # define S_IWUGO (S_IWUSR | S_IWGRP | S_IWOTH) | |||
#endif | #endif | |||
End of changes. 3 change blocks. | ||||
2 lines changed or deleted | 14 lines changed or added | |||
io.h | io.h | |||
---|---|---|---|---|
#ifndef _LIBHX_IO_H | #ifndef _LIBHX_IO_H | |||
#define _LIBHX_IO_H 1 | #define _LIBHX_IO_H 1 | |||
#include <sys/types.h> | #include <sys/types.h> | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
#ifndef __libhx_internal_hxmc_t_defined | ||||
#define __libhx_internal_hxmc_t_defined 1 | ||||
typedef char hxmc_t; | ||||
#endif | ||||
enum { | enum { | |||
HXF_UID = 1 << 0, | HXF_UID = 1 << 0, | |||
HXF_GID = 1 << 1, | HXF_GID = 1 << 1, | |||
HXF_KEEP = 1 << 2, | HXF_KEEP = 1 << 2, | |||
HX_REALPATH_NOFLAGS = 0, | ||||
HX_REALPATH_ABSOLUTE = 1 << 0, | ||||
HX_REALPATH_SELF = 1 << 1, | ||||
HX_REALPATH_PARENT = 1 << 2, | ||||
HX_REALPATH_SYMLINK = 1 << 3, | ||||
HX_REALPATH_DEFAULT = | ||||
HX_REALPATH_SELF | HX_REALPATH_PARENT | HX_REALPATH_SYMLINK, | ||||
}; | }; | |||
struct HXdir; | struct HXdir; | |||
extern struct HXdir *HXdir_open(const char *); | extern struct HXdir *HXdir_open(const char *); | |||
extern const char *HXdir_read(struct HXdir *); | extern const char *HXdir_read(struct HXdir *); | |||
extern void HXdir_close(struct HXdir *); | extern void HXdir_close(struct HXdir *); | |||
extern int HX_copy_dir(const char *, const char *, unsigned int, ...); | extern int HX_copy_dir(const char *, const char *, unsigned int, ...); | |||
extern int HX_copy_file(const char *, const char *, unsigned int, ...); | extern int HX_copy_file(const char *, const char *, unsigned int, ...); | |||
extern int HX_mkdir(const char *); | extern int HX_mkdir(const char *); | |||
extern int HX_readlink(hxmc_t **, const char *); | ||||
extern int HX_realpath(hxmc_t **, const char *, unsigned int); | ||||
extern int HX_rrmdir(const char *); | extern int HX_rrmdir(const char *); | |||
extern ssize_t HXio_fullread(int, void *, size_t); | extern ssize_t HXio_fullread(int, void *, size_t); | |||
extern ssize_t HXio_fullwrite(int, const void *, size_t); | extern ssize_t HXio_fullwrite(int, const void *, size_t); | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
} /* extern "C" */ | } /* extern "C" */ | |||
#endif | #endif | |||
#endif /* _LIBHX_IO_H */ | #endif /* _LIBHX_IO_H */ | |||
End of changes. 3 change blocks. | ||||
0 lines changed or deleted | 14 lines changed or added | |||
misc.h | misc.h | |||
---|---|---|---|---|
skipping to change at line 25 | skipping to change at line 25 | |||
#ifdef __cplusplus | #ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
#endif | #endif | |||
/* | /* | |||
* BITMAP.H | * BITMAP.H | |||
*/ | */ | |||
#define __HXbitmap_bpq(type) \ | #define __HXbitmap_bpq(type) \ | |||
(sizeof(type) * CHAR_BIT) | (sizeof(type) * CHAR_BIT) | |||
#define HXbitmap_size(type, bits) \ | #define HXbitmap_size(type, bits) \ | |||
((bits + __HXbitmap_bpq(type) - 1) / __HXbitmap_bpq(type)) | (((bits) + __HXbitmap_bpq(type) - 1) / __HXbitmap_bpq(type)) | |||
#define __HXbitmap_quant(map, bit) \ | #define __HXbitmap_quant(map, bit) \ | |||
((map)[bit / __HXbitmap_bpq(*(map))]) | ((map)[(bit) / __HXbitmap_bpq(*(map))]) | |||
#define HXbitmap_set(map, bit) \ | #define HXbitmap_set(map, bit) \ | |||
((void)(__HXbitmap_quant(map, bit) |= (1ULL << (bit % __HXbitmap_bpq (*(map)))))) | ((void)(__HXbitmap_quant((map), (bit)) |= (1ULL << ((bit) % __HXbitm ap_bpq(*(map)))))) | |||
#define HXbitmap_clear(map, bit) \ | #define HXbitmap_clear(map, bit) \ | |||
((void)(__HXbitmap_quant(map, bit) &= ~(1ULL << (bit % __HXbitmap_bp q(*(map)))))) | ((void)(__HXbitmap_quant((map), (bit)) &= ~(1ULL << ((bit) % __HXbit map_bpq(*(map)))))) | |||
#define HXbitmap_test(map, bit) \ | #define HXbitmap_test(map, bit) \ | |||
((bool)(__HXbitmap_quant(map, bit) & (1ULL << (bit % __HXbitmap_bpq( *(map)))))) | ((bool)(__HXbitmap_quant((map), (bit)) & (1ULL << ((bit) % __HXbitma p_bpq(*(map)))))) | |||
struct stat; | struct stat; | |||
struct timespec; | struct timespec; | |||
struct timeval; | struct timeval; | |||
/* | /* | |||
* DL.C | * DL.C | |||
*/ | */ | |||
extern void *HX_dlopen(const char *); | extern void *HX_dlopen(const char *); | |||
extern void *HX_dlsym(void *, const char *); | extern void *HX_dlsym(void *, const char *); | |||
End of changes. 5 change blocks. | ||||
5 lines changed or deleted | 5 lines changed or added | |||
option.h | option.h | |||
---|---|---|---|---|
skipping to change at line 80 | skipping to change at line 80 | |||
HXTYPE_STRDQ, | HXTYPE_STRDQ, | |||
HXTYPE_UINT8, | HXTYPE_UINT8, | |||
HXTYPE_UINT16, | HXTYPE_UINT16, | |||
HXTYPE_UINT32, | HXTYPE_UINT32, | |||
HXTYPE_UINT64, | HXTYPE_UINT64, | |||
HXTYPE_INT8, | HXTYPE_INT8, | |||
HXTYPE_INT16, | HXTYPE_INT16, | |||
HXTYPE_INT32, | HXTYPE_INT32, | |||
HXTYPE_INT64, | HXTYPE_INT64, | |||
HXTYPE_MCSTR, /* put into hxmc_t */ | HXTYPE_MCSTR, /* put into hxmc_t */ | |||
HXTYPE_XSNTMARK, /* sentinel marker */ | ||||
/* .type extra flags */ | /* .type extra flags */ | |||
/* argument is optional */ | /* argument is optional */ | |||
HXOPT_OPTIONAL = 1 << 6, | HXOPT_OPTIONAL = 1 << 6, | |||
/* increase pointed variable */ | /* increase pointed variable */ | |||
HXOPT_INC = 1 << 7, | HXOPT_INC = 1 << 7, | |||
/* decrease pointed variable */ | /* decrease pointed variable */ | |||
HXOPT_DEC = 1 << 8, | HXOPT_DEC = 1 << 8, | |||
/* negate input first */ | /* negate input first */ | |||
HXOPT_NOT = 1 << 9, | HXOPT_NOT = 1 << 9, | |||
skipping to change at line 158 | skipping to change at line 159 | |||
} /* extern "C" */ | } /* extern "C" */ | |||
#endif | #endif | |||
#ifndef __cplusplus | #ifndef __cplusplus | |||
# define HXOPT_AUTOHELP \ | # define HXOPT_AUTOHELP \ | |||
{.ln = "help", .sh = '?', .type = HXTYPE_NONE, \ | {.ln = "help", .sh = '?', .type = HXTYPE_NONE, \ | |||
.cb = HX_getopt_help_cb, .help = "Show this help message"}, \ | .cb = HX_getopt_help_cb, .help = "Show this help message"}, \ | |||
{.ln = "usage", .type = HXTYPE_NONE, \ | {.ln = "usage", .type = HXTYPE_NONE, \ | |||
.cb = HX_getopt_usage_cb, \ | .cb = HX_getopt_usage_cb, \ | |||
.help = "Display brief usage message"} | .help = "Display brief usage message"} | |||
# define HXOPT_TABLEEND {.ln = NULL, .sh = 0} | # define HXOPT_TABLEEND {.type = HXTYPE_XSNTMARK} | |||
#else | #else | |||
# define HXOPT_AUTOHELP \ | # define HXOPT_AUTOHELP \ | |||
{NULL, '?', HXTYPE_NONE, NULL, NULL, HX_getopt_help_cb, \ | {NULL, '?', HXTYPE_NONE, NULL, NULL, HX_getopt_help_cb, \ | |||
0, NULL, "Show this help message"} | 0, NULL, "Show this help message"} | |||
# define HXOPT_TABLEEND {NULL, 0} | # define HXOPT_TABLEEND {NULL, 0, HXTYPE_XSNTMARK} | |||
#endif | #endif | |||
#endif /* _LIBHX_OPTION_H */ | #endif /* _LIBHX_OPTION_H */ | |||
End of changes. 3 change blocks. | ||||
2 lines changed or deleted | 3 lines changed or added | |||