diff options
Diffstat (limited to 'include/libHX')
-rw-r--r-- | include/libHX/defs.h | 8 | ||||
-rw-r--r-- | include/libHX/io.h | 5 | ||||
-rw-r--r-- | include/libHX/misc.h | 3 | ||||
-rw-r--r-- | include/libHX/option.h | 12 | ||||
-rw-r--r-- | include/libHX/socket.h | 3 |
5 files changed, 21 insertions, 10 deletions
diff --git a/include/libHX/defs.h b/include/libHX/defs.h index 49ca7d1..9d17019 100644 --- a/include/libHX/defs.h +++ b/include/libHX/defs.h @@ -213,15 +213,15 @@ static __inline__ new_type signed_cast(unsigned char *expr) # define container_of(v, s, m) containerof((v), s, m) #endif -#ifdef _WIN32 +#if !defined(_WIN32) || (defined(__USE_MINGW_ANSI_STDIO) && __USE_MINGW_ANSI_STDIO + 0 > 0) /* * Sufficiently old versions of the VC runtime do not even support %ll. */ -# define HX_LONGLONG_FMT "I64" -# define HX_SIZET_FMT "I" -#else # define HX_LONGLONG_FMT "ll" # define HX_SIZET_FMT "z" +#else +# define HX_LONGLONG_FMT "I64" +# define HX_SIZET_FMT "I" #endif #endif /* _LIBHX_DEFS_H */ diff --git a/include/libHX/io.h b/include/libHX/io.h index 9d35cdc..7e0c7d3 100644 --- a/include/libHX/io.h +++ b/include/libHX/io.h @@ -1,6 +1,7 @@ #ifndef _LIBHX_IO_H #define _LIBHX_IO_H 1 +#include <stdio.h> #include <sys/types.h> #ifdef __cplusplus @@ -41,6 +42,10 @@ extern char *HX_slurp_file(const char *file, size_t *outsize); extern ssize_t HXio_fullread(int, void *, size_t); extern ssize_t HXio_fullwrite(int, const void *, size_t); +#ifndef HX_HEXDUMP_DECLARATION +#define HX_HEXDUMP_DECLARATION 1 +extern void HX_hexdump(FILE *, const void *, unsigned int); +#endif #ifdef __cplusplus } /* extern "C" */ diff --git a/include/libHX/misc.h b/include/libHX/misc.h index 211bc96..23607d2 100644 --- a/include/libHX/misc.h +++ b/include/libHX/misc.h @@ -59,7 +59,10 @@ extern const char *HX_dlerror(void); */ extern int HX_ffs(unsigned long); extern int HX_fls(unsigned long); +#ifndef HX_HEXDUMP_DECLARATION +#define HX_HEXDUMP_DECLARATION 1 extern void HX_hexdump(FILE *, const void *, unsigned int); +#endif extern bool HX_timespec_isneg(const struct timespec *); extern struct timespec *HX_timespec_neg(struct timespec *, const struct timespec *); diff --git a/include/libHX/option.h b/include/libHX/option.h index 5b4bf6f..40cc6e7 100644 --- a/include/libHX/option.h +++ b/include/libHX/option.h @@ -27,12 +27,12 @@ extern struct HXformat_map *HXformat_init(void); extern void HXformat_free(struct HXformat_map *); extern int HXformat_add(struct HXformat_map *, const char *, const void *, unsigned int); -extern int HXformat_aprintf(const struct HXformat_map *, - hxmc_t **, const char *); -extern int HXformat_sprintf(const struct HXformat_map *, - char *, size_t, const char *); -extern int HXformat_fprintf(const struct HXformat_map *, - FILE *, const char *); +#define HXformat_aprintf(a, b, c) HXformat3_aprintf((a), (b), (c)) +#define HXformat_fprintf(a, b, c) HXformat3_fprintf((a), (b), (c)) +#define HXformat_sprintf(a, b, c, d) HXformat3_sprintf((a), (b), (c), (d)) +extern ssize_t HXformat3_aprintf(const struct HXformat_map *, hxmc_t **, const char *); +extern ssize_t HXformat3_fprintf(const struct HXformat_map *, FILE *, const char *); +extern ssize_t HXformat3_sprintf(const struct HXformat_map *, char *, size_t, const char *); /* * OPT.C diff --git a/include/libHX/socket.h b/include/libHX/socket.h index b151682..e9db77f 100644 --- a/include/libHX/socket.h +++ b/include/libHX/socket.h @@ -5,6 +5,7 @@ # include <ws2tcpip.h> #else # include <netdb.h> +# include <sys/socket.h> #endif #ifdef __cplusplus @@ -12,6 +13,8 @@ extern "C" { #endif extern int HX_socket_from_env(const struct addrinfo *, const char *intf); +extern int HX_sockaddr_is_local(const struct sockaddr *, socklen_t, unsigned int flags); +extern int HX_ipaddr_is_local(const char *, unsigned int flags); #ifdef __cplusplus } /* extern "C" */ |