ANSIfy getshort and getlong.

These functions appear to have come from OpenBSD's lib/libc/net/res_comp.c
which made this change in 2005.
This commit is contained in:
Darren Tucker 2022-02-25 13:50:56 +11:00
parent 54a86f4f6e
commit 1b2920e3b6
1 changed files with 8 additions and 10 deletions

View File

@ -89,7 +89,7 @@ struct __res_state _res;
#ifndef GETSHORT #ifndef GETSHORT
#define GETSHORT(s, cp) { \ #define GETSHORT(s, cp) { \
register u_char *t_cp = (u_char *)(cp); \ u_char *t_cp = (u_char *)(cp); \
(s) = ((u_int16_t)t_cp[0] << 8) \ (s) = ((u_int16_t)t_cp[0] << 8) \
| ((u_int16_t)t_cp[1]) \ | ((u_int16_t)t_cp[1]) \
; \ ; \
@ -99,7 +99,7 @@ struct __res_state _res;
#ifndef GETLONG #ifndef GETLONG
#define GETLONG(l, cp) { \ #define GETLONG(l, cp) { \
register u_char *t_cp = (u_char *)(cp); \ u_char *t_cp = (u_char *)(cp); \
(l) = ((u_int32_t)t_cp[0] << 24) \ (l) = ((u_int32_t)t_cp[0] << 24) \
| ((u_int32_t)t_cp[1] << 16) \ | ((u_int32_t)t_cp[1] << 16) \
| ((u_int32_t)t_cp[2] << 8) \ | ((u_int32_t)t_cp[2] << 8) \
@ -115,30 +115,28 @@ struct __res_state _res;
#ifndef HAVE__GETSHORT #ifndef HAVE__GETSHORT
static u_int16_t static u_int16_t
_getshort(msgp) _getshort(const u_char *msgp)
register const u_char *msgp;
{ {
register u_int16_t u; u_int16_t u;
GETSHORT(u, msgp); GETSHORT(u, msgp);
return (u); return (u);
} }
#elif defined(HAVE_DECL__GETSHORT) && (HAVE_DECL__GETSHORT == 0) #elif defined(HAVE_DECL__GETSHORT) && (HAVE_DECL__GETSHORT == 0)
u_int16_t _getshort(register const u_char *); u_int16_t _getshort(const u_char *);
#endif #endif
#ifndef HAVE__GETLONG #ifndef HAVE__GETLONG
static u_int32_t static u_int32_t
_getlong(msgp) _getlong(const u_char *msgp)
register const u_char *msgp;
{ {
register u_int32_t u; u_int32_t u;
GETLONG(u, msgp); GETLONG(u, msgp);
return (u); return (u);
} }
#elif defined(HAVE_DECL__GETLONG) && (HAVE_DECL__GETLONG == 0) #elif defined(HAVE_DECL__GETLONG) && (HAVE_DECL__GETLONG == 0)
u_int32_t _getlong(register const u_char *); u_int32_t _getlong(const u_char *);
#endif #endif
/* ************** */ /* ************** */