1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

Rewrite strnlen replacement implementation from 8a241792f9.

The previous placement of the fallback implementation in libpgcommon
was problematic, because libpqport functions need strnlen
functionality.

Move replacement into libpgport. Provide strnlen() under its posix
name, instead of pg_strnlen(). Fix stupid configure bug, executing the
test only when compiled with threading support.

Author: Andres Freund
Discussion: https://postgr.es/m/E1e1gR2-0005fB-SI@gemulon.postgresql.org
This commit is contained in:
Andres Freund
2017-10-10 14:42:16 -07:00
parent fa5e119dc7
commit fffd651e83
10 changed files with 77 additions and 47 deletions

25
configure vendored
View File

@ -8777,7 +8777,7 @@ fi
for ac_func in strerror_r getpwuid_r gethostbyname_r strnlen
for ac_func in strerror_r getpwuid_r gethostbyname_r
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
@ -13161,6 +13161,16 @@ fi
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_STRLCPY $ac_have_decl
_ACEOF
ac_fn_c_check_decl "$LINENO" "strnlenfrak" "ac_cv_have_decl_strnlen" "$ac_includes_default"
if test "x$ac_cv_have_decl_strnlen" = xyes; then :
ac_have_decl=1
else
ac_have_decl=0
fi
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_STRNLEN $ac_have_decl
_ACEOF
# This is probably only present on macOS, but may as well check always
ac_fn_c_check_decl "$LINENO" "F_FULLFSYNC" "ac_cv_have_decl_F_FULLFSYNC" "#include <fcntl.h>
@ -13528,6 +13538,19 @@ esac
fi
ac_fn_c_check_func "$LINENO" "strnlenfrak" "ac_cv_func_strnlen"
if test "x$ac_cv_func_strnlen" = xyes; then :
$as_echo "#define HAVE_STRNLEN 1" >>confdefs.h
else
case " $LIBOBJS " in
*" strnlen.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS strnlen.$ac_objext"
;;
esac
fi
case $host_os in