Skip to content

Commit abed8b8

Browse files
committed
Remove _IO_cookie_io_functions_t in favor of cookie_io_functions_t
As noted in glibc, the cookie_io_functions_t should be used instead of internal _IO_cookie_io_functions_t. The _IO_cookie_io_functions_t was once used as a convenience for not having the cookie_io_functions_t available (glibc <=2.1.1) as noted in 67bb9d1. Check in the build system was also always setting the COOKIE_IO_FUNCTIONS_T to cookie_io_functions_t due to a typo. There is unused variable have_IO_cookie_io_functions_t vs. have_cookie_io_functions_t. - COOKIE_IO_FUNCTIONS_T removed Closes GH-12236
1 parent 659c06d commit abed8b8

File tree

3 files changed

+7
-24
lines changed

3 files changed

+7
-24
lines changed

UPGRADING.INTERNALS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ PHP 8.4 INTERNALS UPGRADE NOTES
2525

2626
a. Unix build system changes
2727
- The configure option --with-zlib-dir has been removed.
28+
- Symbol COOKIE_IO_FUNCTIONS_T has been removed (use cookie_io_functions_t).
2829

2930
========================
3031
3. Module changes

build/php.m4

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1431,18 +1431,14 @@ AC_DEFUN([PHP_FOPENCOOKIE], [
14311431
AC_CHECK_FUNC(fopencookie, [have_glibc_fopencookie=yes])
14321432
14331433
if test "$have_glibc_fopencookie" = "yes"; then
1434-
dnl This comes in two flavors: newer glibcs (since 2.1.2?) have a type called
1435-
dnl cookie_io_functions_t.
1434+
dnl glibcs (since 2.1.2?) have a type called cookie_io_functions_t.
14361435
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
14371436
#define _GNU_SOURCE
14381437
#include <stdio.h>
14391438
]], [[cookie_io_functions_t cookie;]])],[have_cookie_io_functions_t=yes],[])
14401439
14411440
if test "$have_cookie_io_functions_t" = "yes"; then
1442-
cookie_io_functions_t=cookie_io_functions_t
1443-
have_fopen_cookie=yes
1444-
1445-
dnl Even newer glibcs have a different seeker definition.
1441+
dnl Newer glibcs have a different seeker definition.
14461442
AC_RUN_IFELSE([AC_LANG_SOURCE([[
14471443
#define _GNU_SOURCE
14481444
#include <stdio.h>
@@ -1488,22 +1484,8 @@ int main(void) {
14881484
esac
14891485
])
14901486
1491-
else
1492-
1493-
dnl Older glibc versions (up to 2.1.2?) call it _IO_cookie_io_functions_t.
1494-
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1495-
#define _GNU_SOURCE
1496-
#include <stdio.h>
1497-
]], [[_IO_cookie_io_functions_t cookie;]])], [have_IO_cookie_io_functions_t=yes], [])
1498-
if test "$have_cookie_io_functions_t" = "yes" ; then
1499-
cookie_io_functions_t=_IO_cookie_io_functions_t
1500-
have_fopen_cookie=yes
1501-
fi
1502-
fi
1503-
1504-
if test "$have_fopen_cookie" = "yes" ; then
15051487
AC_DEFINE(HAVE_FOPENCOOKIE, 1, [ ])
1506-
AC_DEFINE_UNQUOTED(COOKIE_IO_FUNCTIONS_T, $cookie_io_functions_t, [ ])
1488+
15071489
if test "$cookie_io_functions_use_off64_t" = "yes" ; then
15081490
AC_DEFINE(COOKIE_SEEKER_USES_OFF64_T, 1, [ ])
15091491
fi

main/streams/cast.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ typedef struct {
4242
int (*writer)(void *, const char *, int);
4343
PHP_FPOS_T (*seeker)(void *, PHP_FPOS_T, int);
4444
int (*closer)(void *);
45-
} COOKIE_IO_FUNCTIONS_T;
45+
} cookie_io_functions_t;
4646

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

135135
#if HAVE_FOPENCOOKIE
136-
static COOKIE_IO_FUNCTIONS_T stream_cookie_functions =
136+
static cookie_io_functions_t stream_cookie_functions =
137137
{
138138
stream_cookie_reader, stream_cookie_writer,
139139
stream_cookie_seeker, stream_cookie_closer

0 commit comments

Comments
 (0)