Skip to content

Commit ba8633a

Browse files
authored
Use fabsf() and floorf() unconditionally in bundled libgd (#13624)
These are available since C99 with math.h also on Windows, without requiring checking. Upstream libgd uses floorf() unconditionally and doesn't use fabsf().
1 parent c443c1d commit ba8633a

File tree

3 files changed

+0
-43
lines changed

3 files changed

+0
-43
lines changed

ext/gd/config.m4

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,6 @@ if test "$PHP_GD" != "no"; then
213213
libgd/gd_transform.c libgd/gd_crop.c libgd/gd_interpolation.c libgd/gd_matrix.c \
214214
libgd/gd_bmp.c libgd/gd_tga.c"
215215

216-
dnl check for fabsf and floorf which are available since C99
217-
AC_CHECK_FUNCS(fabsf floorf)
218-
219216
dnl These are always available with bundled library
220217
AC_DEFINE(HAVE_GD_BUNDLED, 1, [ ])
221218
AC_DEFINE(HAVE_GD_PNG, 1, [ ])

ext/gd/libgd/gd.c

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,36 +8,6 @@
88

99
#include "php.h"
1010

11-
#ifdef _MSC_VER
12-
# if _MSC_VER >= 1300
13-
/* in MSVC.NET these are available but only for __cplusplus and not _MSC_EXTENSIONS */
14-
# if !defined(_MSC_EXTENSIONS) && defined(__cplusplus)
15-
# define HAVE_FABSF 1
16-
extern float fabsf(float x);
17-
# define HAVE_FLOORF 1
18-
extern float floorf(float x);
19-
# endif /*MSVC.NET */
20-
# endif /* MSC */
21-
#endif
22-
#ifndef HAVE_FABSF
23-
# define HAVE_FABSF 0
24-
#endif
25-
#ifndef HAVE_FLOORF
26-
# define HAVE_FLOORF 0
27-
#endif
28-
#if HAVE_FABSF == 0
29-
/* float fabsf(float x); */
30-
# ifndef fabsf
31-
# define fabsf(x) ((float)(fabs(x)))
32-
# endif
33-
#endif
34-
#if HAVE_FLOORF == 0
35-
# ifndef floorf
36-
/* float floorf(float x);*/
37-
# define floorf(x) ((float)(floor(x)))
38-
# endif
39-
#endif
40-
4111
#ifdef _OSD_POSIX /* BS2000 uses the EBCDIC char set instead of ASCII */
4212
#define CHARSET_EBCDIC
4313
#define __attribute__(any) /*nothing */

ext/gd/libgd/gd_interpolation.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,6 @@
6767
# include <emmintrin.h>
6868
#endif
6969

70-
#ifndef HAVE_FLOORF
71-
# define HAVE_FLOORF 0
72-
#endif
73-
#if HAVE_FLOORF == 0
74-
# ifndef floorf
75-
/* float floorf(float x);*/
76-
# define floorf(x) ((float)(floor(x)))
77-
# endif
78-
#endif
79-
8070
#ifndef MIN
8171
#define MIN(a,b) ((a)<(b)?(a):(b))
8272
#endif

0 commit comments

Comments
 (0)