Skip to content

Remove _IO_cookie_io_functions_t in favor of cookie_io_functions_t #12236

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 3 additions & 21 deletions build/php.m4
Original file line number Diff line number Diff line change
Expand Up @@ -1431,18 +1431,14 @@ AC_DEFUN([PHP_FOPENCOOKIE], [
AC_CHECK_FUNC(fopencookie, [have_glibc_fopencookie=yes])

if test "$have_glibc_fopencookie" = "yes"; then
dnl This comes in two flavors: newer glibcs (since 2.1.2?) have a type called
dnl cookie_io_functions_t.
dnl glibcs (since 2.1.2?) have a type called cookie_io_functions_t.
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#define _GNU_SOURCE
#include <stdio.h>
]], [[cookie_io_functions_t cookie;]])],[have_cookie_io_functions_t=yes],[])

if test "$have_cookie_io_functions_t" = "yes"; then
cookie_io_functions_t=cookie_io_functions_t
have_fopen_cookie=yes

dnl Even newer glibcs have a different seeker definition.
dnl Newer glibcs have a different seeker definition.
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#define _GNU_SOURCE
#include <stdio.h>
Expand Down Expand Up @@ -1488,22 +1484,8 @@ int main(void) {
esac
])

else

dnl Older glibc versions (up to 2.1.2?) call it _IO_cookie_io_functions_t.
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#define _GNU_SOURCE
#include <stdio.h>
]], [[_IO_cookie_io_functions_t cookie;]])], [have_IO_cookie_io_functions_t=yes], [])
if test "$have_cookie_io_functions_t" = "yes" ; then
cookie_io_functions_t=_IO_cookie_io_functions_t
have_fopen_cookie=yes
fi
fi

if test "$have_fopen_cookie" = "yes" ; then
AC_DEFINE(HAVE_FOPENCOOKIE, 1, [ ])
AC_DEFINE_UNQUOTED(COOKIE_IO_FUNCTIONS_T, $cookie_io_functions_t, [ ])

if test "$cookie_io_functions_use_off64_t" = "yes" ; then
AC_DEFINE(COOKIE_SEEKER_USES_OFF64_T, 1, [ ])
fi
Expand Down
6 changes: 3 additions & 3 deletions main/streams/cast.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ typedef struct {
int (*writer)(void *, const char *, int);
PHP_FPOS_T (*seeker)(void *, PHP_FPOS_T, int);
int (*closer)(void *);
} COOKIE_IO_FUNCTIONS_T;
} cookie_io_functions_t;

FILE *fopencookie(void *cookie, const char *mode, COOKIE_IO_FUNCTIONS_T *funcs)
FILE *fopencookie(void *cookie, const char *mode, cookie_io_functions_t *funcs)
{
return funopen(cookie, funcs->reader, funcs->writer, funcs->seeker, funcs->closer);
}
Expand Down Expand Up @@ -133,7 +133,7 @@ static int stream_cookie_closer(void *cookie)
#endif /* elif defined(HAVE_FOPENCOOKIE) */

#if HAVE_FOPENCOOKIE
static COOKIE_IO_FUNCTIONS_T stream_cookie_functions =
static cookie_io_functions_t stream_cookie_functions =
{
stream_cookie_reader, stream_cookie_writer,
stream_cookie_seeker, stream_cookie_closer
Expand Down