From 039869fe77dcfe40b983f502885ce55c42ccee16 Mon Sep 17 00:00:00 2001 From: Aleksandr Karpinskii Date: Sun, 1 Sep 2024 21:14:51 +0400 Subject: [PATCH] Move import math.h to ImagingPlatform --- src/_imaging.c | 2 -- src/_imagingmath.c | 1 - src/libImaging/ColorLUT.c | 1 - src/libImaging/Draw.c | 2 -- src/libImaging/Effects.c | 2 -- src/libImaging/Fill.c | 2 -- src/libImaging/Imaging.h | 4 ---- src/libImaging/ImagingPlatform.h | 3 +++ src/libImaging/Palette.c | 2 -- src/libImaging/Quant.c | 1 - src/libImaging/Reduce.c | 2 -- src/libImaging/Resample.c | 2 -- src/path.c | 2 -- 13 files changed, 3 insertions(+), 23 deletions(-) diff --git a/src/_imaging.c b/src/_imaging.c index 1201e8db7..b84784caf 100644 --- a/src/_imaging.c +++ b/src/_imaging.c @@ -85,8 +85,6 @@ #include "libImaging/Imaging.h" -#define _USE_MATH_DEFINES -#include #include #undef VERBOSE diff --git a/src/_imagingmath.c b/src/_imagingmath.c index f54ca6cd5..1c60ad7f4 100644 --- a/src/_imagingmath.c +++ b/src/_imagingmath.c @@ -15,7 +15,6 @@ #include "libImaging/Imaging.h" -#include #include #define MAX_INT32 2147483647.0 diff --git a/src/libImaging/ColorLUT.c b/src/libImaging/ColorLUT.c index 5559de689..33633f555 100644 --- a/src/libImaging/ColorLUT.c +++ b/src/libImaging/ColorLUT.c @@ -1,5 +1,4 @@ #include "Imaging.h" -#include /* 8 bits for result. Table can overflow [0, 1.0] range, so we need extra bits for overflow and negative values. diff --git a/src/libImaging/Draw.c b/src/libImaging/Draw.c index 5c61e0e7e..730bba8ac 100644 --- a/src/libImaging/Draw.c +++ b/src/libImaging/Draw.c @@ -34,8 +34,6 @@ #include "Imaging.h" -#include - #define CEIL(v) (int)ceil(v) #define FLOOR(v) ((v) >= 0.0 ? (int)(v) : (int)floor(v)) diff --git a/src/libImaging/Effects.c b/src/libImaging/Effects.c index 93e7af0bc..64d6188d9 100644 --- a/src/libImaging/Effects.c +++ b/src/libImaging/Effects.c @@ -17,8 +17,6 @@ #include "Imaging.h" -#include - Imaging ImagingEffectMandelbrot(int xsize, int ysize, double extent[4], int quality) { /* Generate a Mandelbrot set covering the given extent */ diff --git a/src/libImaging/Fill.c b/src/libImaging/Fill.c index 8fb481e7e..1e4bb9ba0 100644 --- a/src/libImaging/Fill.c +++ b/src/libImaging/Fill.c @@ -17,8 +17,6 @@ #include "Imaging.h" -#include "math.h" - Imaging ImagingFill(Imaging im, const void *colour) { int x, y; diff --git a/src/libImaging/Imaging.h b/src/libImaging/Imaging.h index 315ec4440..7ba809bf4 100644 --- a/src/libImaging/Imaging.h +++ b/src/libImaging/Imaging.h @@ -16,10 +16,6 @@ extern "C" { #endif -#ifndef M_PI -#define M_PI 3.1415926535897932384626433832795 -#endif - /* -------------------------------------------------------------------- */ /* diff --git a/src/libImaging/ImagingPlatform.h b/src/libImaging/ImagingPlatform.h index 78d27067c..3a3875daf 100644 --- a/src/libImaging/ImagingPlatform.h +++ b/src/libImaging/ImagingPlatform.h @@ -10,6 +10,9 @@ #define PY_SSIZE_T_CLEAN #include +#define _USE_MATH_DEFINES +#include + /* Check that we have an ANSI compliant compiler */ #ifndef HAVE_PROTOTYPES #error Sorry, this library requires support for ANSI prototypes. diff --git a/src/libImaging/Palette.c b/src/libImaging/Palette.c index 78916bca5..032ce8ab2 100644 --- a/src/libImaging/Palette.c +++ b/src/libImaging/Palette.c @@ -18,8 +18,6 @@ #include "Imaging.h" -#include - ImagingPalette ImagingPaletteNew(const char *mode) { /* Create a palette object */ diff --git a/src/libImaging/Quant.c b/src/libImaging/Quant.c index a489a882d..147d8ae52 100644 --- a/src/libImaging/Quant.c +++ b/src/libImaging/Quant.c @@ -1428,7 +1428,6 @@ quantize( } #ifdef TEST_NEAREST_NEIGHBOUR -#include { uint32_t bestmatch, bestdist, dist; HashTable *h2; diff --git a/src/libImaging/Reduce.c b/src/libImaging/Reduce.c index 022daa000..6da18d773 100644 --- a/src/libImaging/Reduce.c +++ b/src/libImaging/Reduce.c @@ -1,7 +1,5 @@ #include "Imaging.h" -#include - #define ROUND_UP(f) ((int)((f) >= 0.0 ? (f) + 0.5F : (f) - 0.5F)) UINT32 diff --git a/src/libImaging/Resample.c b/src/libImaging/Resample.c index f5e386dc2..978bf74c7 100644 --- a/src/libImaging/Resample.c +++ b/src/libImaging/Resample.c @@ -1,7 +1,5 @@ #include "Imaging.h" -#include - #define ROUND_UP(f) ((int)((f) >= 0.0 ? (f) + 0.5F : (f) - 0.5F)) struct filter { diff --git a/src/path.c b/src/path.c index 53c1dd8c4..c9c2d61ef 100644 --- a/src/path.c +++ b/src/path.c @@ -28,8 +28,6 @@ #include "libImaging/Imaging.h" #include "thirdparty/pythoncapi_compat.h" -#include - /* compatibility wrappers (defined in _imaging.c) */ extern int PyImaging_CheckBuffer(PyObject *buffer);