On Mon, Oct 12, 2020 at 02:43:06PM +0900, Masahiko Sawada wrote: > The following warning recently started to be shown in my > environment(FreeBSD clang 8.0.1). Maybe it is relevant with this > commit: > > unicode_norm.c:478:12: warning: implicit declaration of function > 'htonl' is invalid in C99 [-Wimplicit-function-declaration] > hashkey = htonl(ch); > ^
Thanks, it is of course relevant to this commit. None of the BSD animals complain here. So, while it would be tempting to have an extra include with arpa/inet.h, I think that it would be better to just use pg_hton32() in pg_bswap.h, as per the attached. Does that take care of your problem? -- Michael
diff --git a/src/common/unicode_norm.c b/src/common/unicode_norm.c index 626645ac87..4bb6a0f587 100644 --- a/src/common/unicode_norm.c +++ b/src/common/unicode_norm.c @@ -23,6 +23,7 @@ #ifndef FRONTEND #include "common/unicode_normprops_table.h" #endif +#include "port/pg_bswap.h" #ifndef FRONTEND #define ALLOC(size) palloc(size) @@ -475,7 +476,7 @@ qc_hash_lookup(pg_wchar ch, const pg_unicode_norminfo *norminfo) * Compute the hash function. The hash key is the codepoint with the bytes * in network order. */ - hashkey = htonl(ch); + hashkey = pg_hton32(ch); h = norminfo->hash(&hashkey); /* An out-of-range result implies no match */
signature.asc
Description: PGP signature