From: Guy Harris Date: Mon, 28 Mar 2022 19:44:50 +0000 (-0700) Subject: Move nd_trunc_longjmp() to netdissect.h with the other nd_ functions. X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/518e1bf60b5a72f29593e00a535f0a563d5d077b Move nd_trunc_longjmp() to netdissect.h with the other nd_ functions. It's not particularly tied to the data-extraction functions; this makes it available elsewhere. --- diff --git a/extract.h b/extract.h index c355c4d9..685fe95e 100644 --- a/extract.h +++ b/extract.h @@ -576,20 +576,6 @@ EXTRACT_IPV4_TO_NETWORK_ORDER(const void *p) #define ND_TTEST_16(p) ND_TTEST_LEN((p), 16) #define ND_TCHECK_16(p) ND_TCHECK_LEN((p), 16) -static inline NORETURN void -nd_trunc_longjmp(netdissect_options *ndo) -{ - longjmp(ndo->ndo_early_end, ND_TRUNCATED); -#ifdef _AIX - /* - * In AIX decorates longjmp() with "#pragma leaves", which tells - * XL C that the function is noreturn, but GCC remains unaware of that and - * yields a "'noreturn' function does return" warning. - */ - ND_UNREACHABLE -#endif /* _AIX */ -} - /* get_u_1 and get_s_1 */ static inline uint8_t diff --git a/netdissect.h b/netdissect.h index 867be794..e2b77860 100644 --- a/netdissect.h +++ b/netdissect.h @@ -269,6 +269,20 @@ extern void nd_change_snapend(netdissect_options *, const u_char *); extern void nd_pop_packet_info(netdissect_options *); extern void nd_pop_all_packet_info(netdissect_options *); +static inline NORETURN void +nd_trunc_longjmp(netdissect_options *ndo) +{ + longjmp(ndo->ndo_early_end, ND_TRUNCATED); +#ifdef _AIX + /* + * In AIX decorates longjmp() with "#pragma leaves", which tells + * XL C that the function is noreturn, but GCC remains unaware of that and + * yields a "'noreturn' function does return" warning. + */ + ND_UNREACHABLE +#endif /* _AIX */ +} + #define PT_VAT 1 /* Visual Audio Tool */ #define PT_WB 2 /* distributed White Board */ #define PT_RPC 3 /* Remote Procedure Call */