Skip to content

Commit

Permalink
Move default param counts to header
Browse files Browse the repository at this point in the history
  • Loading branch information
Bogdan Drozdowski committed May 25, 2023
1 parent 28e8782 commit 6dc62a6
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 36 deletions.
18 changes: 0 additions & 18 deletions src/lhip_net.c
Expand Up @@ -293,12 +293,6 @@ gethostbyaddr (

/* =============================================================== */

#if (!defined HAVE_FUNC_GETHOSTBYADDR_R_8) \
&& (!defined HAVE_FUNC_GETHOSTBYADDR_R_7) \
&& (!defined HAVE_FUNC_GETHOSTBYADDR_R_5)
# define HAVE_FUNC_GETHOSTBYADDR_R_8 1
#endif

#ifdef HAVE_FUNC_GETHOSTBYADDR_R_8
int
#else /* ! HAVE_FUNC_GETHOSTBYADDR_R_8 */
Expand Down Expand Up @@ -477,12 +471,6 @@ gethostbyname (

/* =============================================================== */

#if (!defined HAVE_FUNC_GETHOSTBYNAME_R_6) \
&& (!defined HAVE_FUNC_GETHOSTBYNAME_R_5) \
&& (!defined HAVE_FUNC_GETHOSTBYNAME_R_3)
# define HAVE_FUNC_GETHOSTBYNAME_R_6 1
#endif

#ifdef HAVE_FUNC_GETHOSTBYNAME_R_6
int
#else /* ! HAVE_FUNC_GETHOSTBYNAME_R_6 */
Expand Down Expand Up @@ -746,12 +734,6 @@ gethostent (

/* =============================================================== */

#if (!defined HAVE_FUNC_GETHOSTENT_R_5) \
&& (!defined HAVE_FUNC_GETHOSTENT_R_4) \
&& (!defined HAVE_FUNC_GETHOSTENT_R_2)
# define HAVE_FUNC_GETHOSTENT_R_5 1
#endif

#ifdef HAVE_FUNC_GETHOSTENT_R_5
int
#else /* ! HAVE_FUNC_GETHOSTENT_R_5 */
Expand Down
56 changes: 38 additions & 18 deletions src/lhip_priv.h
Expand Up @@ -242,53 +242,73 @@ typedef struct {
/* --- Function typedefs. */
/* network-related functions: */
typedef struct hostent * (*shp_vp_sl_i) LHIP_PARAMS ((const void * addr, socklen_t len, int type));
#ifdef HAVE_FUNC_GETHOSTBYADDR_R_8

# if (!defined HAVE_FUNC_GETHOSTBYADDR_R_8) \
&& (!defined HAVE_FUNC_GETHOSTBYADDR_R_7) \
&& (!defined HAVE_FUNC_GETHOSTBYADDR_R_5)
# define HAVE_FUNC_GETHOSTBYADDR_R_8 1
# endif

# ifdef HAVE_FUNC_GETHOSTBYADDR_R_8
typedef int (*i_vp_sl_i_shp_cp_s_shpp_ip) LHIP_PARAMS ((const void *addr, socklen_t len, int type,
struct hostent *ret, char *buf, size_t buflen,
struct hostent **result, int *h_errnop));
#else /* ! HAVE_FUNC_GETHOSTBYADDR_R_8 */
# ifdef HAVE_FUNC_GETHOSTBYADDR_R_7
# else /* ! HAVE_FUNC_GETHOSTBYADDR_R_8 */
# ifdef HAVE_FUNC_GETHOSTBYADDR_R_7
/* SunOS */
typedef struct hostent * (*i_vp_sl_i_shp_cp_s_shpp_ip) LHIP_PARAMS ((const char *, int, int,
struct hostent *, char *,
int, int *));
# else
# else
typedef int(*i_vp_sl_i_shp_cp_s_shpp_ip) LHIP_PARAMS ((const char *addr, size_t len, int type,
struct hostent *ret, struct hostent_data *data));
# endif
#endif /* HAVE_FUNC_GETHOSTBYADDR_R_8 */
# endif
# endif /* HAVE_FUNC_GETHOSTBYADDR_R_8 */
typedef struct hostent * (*shp_cp) LHIP_PARAMS ((const char *name));
#ifdef HAVE_FUNC_GETHOSTBYNAME_R_6

# if (!defined HAVE_FUNC_GETHOSTBYNAME_R_6) \
&& (!defined HAVE_FUNC_GETHOSTBYNAME_R_5) \
&& (!defined HAVE_FUNC_GETHOSTBYNAME_R_3)
# define HAVE_FUNC_GETHOSTBYNAME_R_6 1
# endif

# ifdef HAVE_FUNC_GETHOSTBYNAME_R_6
typedef int (*i_cp_shp_cp_s_shpp_ip) LHIP_PARAMS ((const char *name,
struct hostent *ret, char *buf, size_t buflen,
struct hostent **result, int *h_errnop));
#else /* ! HAVE_FUNC_GETHOSTBYNAME_R_6 */
# ifdef HAVE_FUNC_GETHOSTBYNAME_R_5
# else /* ! HAVE_FUNC_GETHOSTBYNAME_R_6 */
# ifdef HAVE_FUNC_GETHOSTBYNAME_R_5
typedef struct hostent * (*i_cp_shp_cp_s_shpp_ip) LHIP_PARAMS ((const char *name,
struct hostent *ret, char *buf,
int buflen, int *h_errnop));
# else /* ! HAVE_FUNC_GETHOSTBYNAME_R_5 */
# else /* ! HAVE_FUNC_GETHOSTBYNAME_R_5 */
typedef int (*i_cp_shp_cp_s_shpp_ip) LHIP_PARAMS ((const char *name,
struct hostent *ret, struct hostent_data *data));
# endif /* HAVE_FUNC_GETHOSTBYNAME_R_5 */
#endif /* HAVE_FUNC_GETHOSTBYNAME_R_6 */
# endif /* HAVE_FUNC_GETHOSTBYNAME_R_5 */
# endif /* HAVE_FUNC_GETHOSTBYNAME_R_6 */
typedef struct hostent * (*shp_cp_i) LHIP_PARAMS ((const char *name, int af));
typedef int (*i_cp_i_shp_cp_s_shpp_i) LHIP_PARAMS ((const char *name, int af,
struct hostent *ret, char *buf, size_t buflen,
struct hostent **result, int *h_errnop));
typedef struct hostent * (*shp_v) LHIP_PARAMS ((void));
#ifdef HAVE_FUNC_GETHOSTENT_R_5
# if (!defined HAVE_FUNC_GETHOSTENT_R_5) \
&& (!defined HAVE_FUNC_GETHOSTENT_R_4) \
&& (!defined HAVE_FUNC_GETHOSTENT_R_2)
# define HAVE_FUNC_GETHOSTENT_R_5 1
# endif

# ifdef HAVE_FUNC_GETHOSTENT_R_5
typedef int (*i_shp_cp_s_shpp_ip) LHIP_PARAMS ((struct hostent *ret, char *buf, size_t buflen,
struct hostent **result, int *h_errnop));
#else /* ! HAVE_FUNC_GETHOSTENT_R_5 */
# ifdef HAVE_FUNC_GETHOSTENT_R_4
# else /* ! HAVE_FUNC_GETHOSTENT_R_5 */
# ifdef HAVE_FUNC_GETHOSTENT_R_4
typedef struct hostent * (*i_shp_cp_s_shpp_ip) LHIP_PARAMS ((struct hostent *ret, char *buf,
int buflen, int *h_errnop));
# else /* ! HAVE_FUNC_GETHOSTENT_R_4 */
# else /* ! HAVE_FUNC_GETHOSTENT_R_4 */
typedef int (*i_shp_cp_s_shpp_ip) LHIP_PARAMS ((struct hostent *htent,
struct hostent_data *ht_data));
# endif /* HAVE_FUNC_GETHOSTENT_R_4 */
#endif /* HAVE_FUNC_GETHOSTENT_R_5 */
# endif /* HAVE_FUNC_GETHOSTENT_R_4 */
# endif /* HAVE_FUNC_GETHOSTENT_R_5 */
typedef struct hostent * (*shp_cp_s_i_ip) LHIP_PARAMS ((const void *addr,
size_t len, int af, int *error_num));
typedef struct hostent * (*shp_cp_i_i_ip) LHIP_PARAMS ((const char *name,
Expand Down

0 comments on commit 6dc62a6

Please sign in to comment.