mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-22 07:03:38 +00:00
errnostring: Handle changed type of 'len' parameter in gperf 3.1 (RHBZ#1416941).
The prototype of the hash function changed in gperf 3.1: * The 'len' parameter of the hash function and of the lookup function is now of type 'size_t' instead of 'unsigned int'. This makes it safe to call these functions with strings of length > 4 GB, on 64-bit machines. This change tries to detect the required type in ./configure Thanks: Marius Cirsta
This commit is contained in:
@@ -231,7 +231,7 @@ extern int guestfs_int_string_to_errno (const char *errnostr);
|
||||
|
||||
/* Private structure and function used by the perfect hash implementation. */
|
||||
struct errnostring_entry { char *name; int errnum; };
|
||||
extern const struct errnostring_entry *guestfs_int_string_to_errno_lookup (register const char *str, register unsigned int len);
|
||||
extern const struct errnostring_entry *guestfs_int_string_to_errno_lookup (register const char *str, register GPERF_SIZE_T len);
|
||||
|
||||
#endif /* GUESTFS_ERRNOSTRING_H_ */
|
||||
"
|
||||
|
||||
@@ -50,6 +50,26 @@ AC_CHECK_PROG([GPERF],[gperf],[gperf],[no])
|
||||
test "x$GPERF" = "xno" &&
|
||||
AC_MSG_ERROR([gperf must be installed])
|
||||
|
||||
dnl Determine type of gperf hash function (changed in gperf 3.1).
|
||||
AC_MSG_CHECKING([type of gperf hash len parameter])
|
||||
cat > conftest.gperf <<EOF
|
||||
%language=ANSI-C
|
||||
%%
|
||||
A, 1
|
||||
%%
|
||||
EOF
|
||||
GPERF_SIZE_T=$(
|
||||
$GPERF conftest.gperf |
|
||||
grep '^hash (.*len)$' |
|
||||
$SED 's/.*, register \([[^,]]*\) len)$/\1/'
|
||||
)
|
||||
if test "x$GPERF_SIZE_T" = "x"; then
|
||||
AC_MSG_ERROR([could not detect type of gperf hash len parameter])
|
||||
fi
|
||||
AC_MSG_RESULT([$GPERF_SIZE_T])
|
||||
AC_DEFINE_UNQUOTED([GPERF_SIZE_T],[$GPERF_SIZE_T],[Type of gperf hash len parameter.])
|
||||
rm conftest.gperf
|
||||
|
||||
dnl Check for genisoimage/mkisofs
|
||||
AC_PATH_PROGS([GENISOIMAGE],[genisoimage mkisofs],[no],
|
||||
[$PATH$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/sbin])
|
||||
|
||||
Reference in New Issue
Block a user