1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
|
From: Ole Streicher <olebole@debian.org>
Date: Fri, 12 Sep 2025 22:35:21 +0200
Subject: Use local bool_ datatype
In C23, "bool" is a reserved keyword. To be backward compliant, we
still use the old definition but rename it to bool_.
---
astroscrappy/utils/imutils.c | 10 +++++-----
astroscrappy/utils/imutils.h | 6 +++---
astroscrappy/utils/medutils.h | 2 +-
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/astroscrappy/utils/imutils.c b/astroscrappy/utils/imutils.c
index cc87be9..c59a743 100644
--- a/astroscrappy/utils/imutils.c
+++ b/astroscrappy/utils/imutils.c
@@ -334,7 +334,7 @@ PyLaplaceConvolve(float* data, float* output, int nx, int ny)
* data[i + nx * j].
*/
void
-PyDilate3(bool* data, bool* output, int nx, int ny)
+PyDilate3(bool_* data, bool_* output, int nx, int ny)
{
PyDoc_STRVAR(PyDilate3__doc__,
"PyDilate3(data, output, nx, ny) -> void\n\n"
@@ -355,7 +355,7 @@ PyDilate3(bool* data, bool* output, int nx, int ny)
/* Pixel value p. Each thread needs its own unique copy of this so we don't
initialize this until the pragma below. */
- bool p;
+ bool_ p;
#pragma omp parallel for firstprivate(output, data, nxny, nx, ny) \
private(i, j, nxj, p)
@@ -419,7 +419,7 @@ PyDilate3(bool* data, bool* output, int nx, int ny)
* memory location of pixel i,j is data[i + nx * j].
*/
void
-PyDilate5(bool* data, bool* output, int niter, int nx, int ny)
+PyDilate5(bool_* data, bool_* output, int niter, int nx, int ny)
{
PyDoc_STRVAR(PyDilate5__doc__,
"PyDilate5(data, output, nx, ny) -> void\n\n"
@@ -445,7 +445,7 @@ PyDilate5(bool* data, bool* output, int niter, int nx, int ny)
int nxny = nx * ny;
/* The padded array to work on */
- bool* padarr = (bool *) malloc(padnxny * sizeof(bool));
+ bool_* padarr = (bool_ *) malloc(padnxny * sizeof(bool_));
/*Loop indices */
int i, j, nxj, padnxj;
@@ -453,7 +453,7 @@ PyDilate5(bool* data, bool* output, int niter, int nx, int ny)
/* Pixel value p. This needs to be unique for each thread so we initialize
* it below inside the pragma. */
- bool p;
+ bool_ p;
#pragma omp parallel firstprivate(padarr, padnx, padnxny) private(i)
/* Initialize the borders of the padded array to zero */
diff --git a/astroscrappy/utils/imutils.h b/astroscrappy/utils/imutils.h
index 8acf88a..3c9e36e 100644
--- a/astroscrappy/utils/imutils.h
+++ b/astroscrappy/utils/imutils.h
@@ -16,7 +16,7 @@
#include <stdint.h>
/* Define a bool type because there isn't one built in ANSI C */
-typedef uint8_t bool;
+typedef uint8_t bool_;
#define true 1
#define false 0
@@ -77,7 +77,7 @@ PyLaplaceConvolve(float* data, float* output, int nx, int ny);
* data[i + nx * j].
*/
void
-PyDilate3(bool* data, bool* output, int nx, int ny);
+PyDilate3(bool_* data, bool_* output, int nx, int ny);
/* Do niter iterations of boolean dilation on an array of size nx x ny. The
* results are saved in the output array. The output array should already be
@@ -95,6 +95,6 @@ PyDilate3(bool* data, bool* output, int nx, int ny);
* memory location of pixel i,j is data[i + nx * j].
*/
void
-PyDilate5(bool* data, bool* output, int iter, int nx, int ny);
+PyDilate5(bool_* data, bool_* output, int iter, int nx, int ny);
#endif /* IMUTILS_H_ */
diff --git a/astroscrappy/utils/medutils.h b/astroscrappy/utils/medutils.h
index b7aa72b..0d16865 100644
--- a/astroscrappy/utils/medutils.h
+++ b/astroscrappy/utils/medutils.h
@@ -16,7 +16,7 @@
#include <stdint.h>
/* Define a bool type because there isn't one built in ANSI C */
-typedef uint8_t bool;
+typedef uint8_t bool_;
#define true 1
#define false 0
|