...to `NC_INFINITY`.  Clang 20, at least on my aarch64 Termux device,
squats on the name `INFINITY`.

Fixes:
../ncurses/ncurses.priv.h:2059:9:warning 'INFINITY' macro redefined 
[-Wmacro-redefined]
/data/data/com.termux/files/usr/lib/clang/clang/20/include/float.h:173:11: 
note: previous definition is here
---
 ncurses/curses.priv.h         |  8 +++----
 ncurses/tinfo/lib_win32con.c  |  4 ++--
 ncurses/tty/lib_mvcur.c       | 42 +++++++++++++++++------------------
 ncurses/win32con/win_driver.c |  4 ++--
 4 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/ncurses/curses.priv.h b/ncurses/curses.priv.h
index 986a12582..c6f0695c5 100644
--- a/ncurses/curses.priv.h
+++ b/ncurses/curses.priv.h
@@ -1874,7 +1874,7 @@ extern    NCURSES_EXPORT(void) name (void); \
                ? sp->_dch_cost \
                : ((delete_character != NULL) \
                        ? (sp->_dch1_cost * count) \
-                       : INFINITY))
+                       : NC_INFINITY))
 
 #define InsCharCost(sp,count) \
                ((parm_ich != NULL) \
@@ -1883,7 +1883,7 @@ extern    NCURSES_EXPORT(void) name (void); \
                  ? sp->_smir_cost + sp->_rmir_cost + (sp->_ip_cost * count) \
                  : ((insert_character != NULL) \
                    ? ((sp->_ich1_cost + sp->_ip_cost) * count) \
-                   : INFINITY)))
+                   : NC_INFINITY)))
 
 #if USE_XMC_SUPPORT
 #define UpdateAttrs(sp,c) if (!SameAttrOf(SCREEN_ATTRS(sp), c)) { \
@@ -2056,7 +2056,7 @@ extern NCURSES_EXPORT(int) _nc_wgetch(WINDOW *, int *, 
int EVENTLIST_2nd(_nc_eve
 extern NCURSES_EXPORT(int) _nc_insert_ch(SCREEN *, WINDOW *, chtype);
 
 /* lib_mvcur.c */
-#define INFINITY       1000000 /* cost: too high to use */
+#define NC_INFINITY    1000000 /* cost: too high to use */
 
 extern NCURSES_EXPORT(int) _nc_mvcur(int yold, int xold, int ynew, int xnew);
 
@@ -2074,7 +2074,7 @@ extern NCURSES_EXPORT(void) _nc_screen_wrap (void);
 extern NCURSES_EXPORT(bool) _nc_has_mouse (const SCREEN *);
 
 /* lib_mvcur.c */
-#define INFINITY       1000000 /* cost: too high to use */
+#define NC_INFINITY    1000000 /* cost: too high to use */
 #define BAUDBYTE       9       /* 9 = 7 bits + 1 parity + 1 stop */
 
 /* lib_setup.c */
diff --git a/ncurses/tinfo/lib_win32con.c b/ncurses/tinfo/lib_win32con.c
index 4950bf64f..c2cb0c8a2 100644
--- a/ncurses/tinfo/lib_win32con.c
+++ b/ncurses/tinfo/lib_win32con.c
@@ -591,7 +591,7 @@ tdiff(FILETIME fstart, FILETIME fend)
 static int
 Adjust(int milliseconds, int diff)
 {
-    if (milliseconds != INFINITY) {
+    if (milliseconds != NC_INFINITY) {
        milliseconds -= diff;
        if (milliseconds < 0)
            milliseconds = 0;
@@ -832,7 +832,7 @@ _nc_console_twait(
                      hdl, milliseconds, mode));
 
     if (milliseconds < 0)
-       milliseconds = INFINITY;
+       milliseconds = NC_INFINITY;
 
     memset(&inp_rec, 0, sizeof(inp_rec));
 
diff --git a/ncurses/tty/lib_mvcur.c b/ncurses/tty/lib_mvcur.c
index 0bde81d14..ae8c181a7 100644
--- a/ncurses/tty/lib_mvcur.c
+++ b/ncurses/tty/lib_mvcur.c
@@ -223,7 +223,7 @@ NCURSES_SP_NAME(_nc_msec_cost) (NCURSES_SP_DCLx const char 
*const cap, int affcn
 /* compute the cost of a given operation */
 {
     if (cap == NULL)
-       return (INFINITY);
+       return (NC_INFINITY);
     else {
        const char *cp;
        float cum_cost = 0.0;
@@ -287,7 +287,7 @@ normalized_cost(NCURSES_SP_DCLx const char *const cap, int 
affcnt)
 /* compute the effective character-count for an operation (round up) */
 {
     int cost = NCURSES_SP_NAME(_nc_msec_cost) (NCURSES_SP_ARGx cap, affcnt);
-    if (cost != INFINITY)
+    if (cost != NC_INFINITY)
        cost = (cost + SP_PARM->_char_padding - 1) / SP_PARM->_char_padding;
     return cost;
 }
@@ -370,8 +370,8 @@ NCURSES_SP_NAME(_nc_mvcur_init) (NCURSES_SP_DCL0)
        SP_PARM->_ht_cost = CostOf(tab, 0);
        SP_PARM->_cbt_cost = CostOf(back_tab, 0);
     } else {
-       SP_PARM->_ht_cost = INFINITY;
-       SP_PARM->_cbt_cost = INFINITY;
+       SP_PARM->_ht_cost = NC_INFINITY;
+       SP_PARM->_cbt_cost = NC_INFINITY;
     }
 #endif /* USE_HARD_TABS */
     SP_PARM->_cub1_cost = CostOf(cursor_left, 0);
@@ -543,12 +543,12 @@ repeated_append(string_desc * target, int total, int num, 
int repeat, const char
            if (_nc_safe_strcat(target, src)) {
                total += num;
            } else {
-               total = INFINITY;
+               total = NC_INFINITY;
                break;
            }
        }
     } else {
-       total = INFINITY;
+       total = NC_INFINITY;
     }
     return total;
 }
@@ -578,7 +578,7 @@ relative_move(NCURSES_SP_DCLx
     (void) _nc_str_copy(&save, target);
 
     if (to_y != from_y) {
-       vcost = INFINITY;
+       vcost = NC_INFINITY;
 
        if (row_address != NULL
            && _nc_safe_strcat(target, TIPARM_1(row_address, to_y))) {
@@ -617,8 +617,8 @@ relative_move(NCURSES_SP_DCLx
            }
        }
 
-       if (vcost == INFINITY)
-           return (INFINITY);
+       if (vcost == NC_INFINITY)
+           return (NC_INFINITY);
     }
 
     save = *target;
@@ -627,7 +627,7 @@ relative_move(NCURSES_SP_DCLx
        char str[OPT_SIZE];
        string_desc check;
 
-       hcost = INFINITY;
+       hcost = NC_INFINITY;
 
        if (column_address
            && _nc_safe_strcat(_nc_str_copy(target, &save),
@@ -658,7 +658,7 @@ relative_move(NCURSES_SP_DCLx
                    for (fr = from_x; (nxt = NEXTTAB(fr)) <= to_x; fr = nxt) {
                        lhcost = repeated_append(&check, lhcost,
                                                 SP_PARM->_ht_cost, 1, tab);
-                       if (lhcost == INFINITY)
+                       if (lhcost == NC_INFINITY)
                            break;
                    }
 
@@ -751,7 +751,7 @@ relative_move(NCURSES_SP_DCLx
                        lhcost = repeated_append(&check, lhcost,
                                                 SP_PARM->_cbt_cost,
                                                 1, back_tab);
-                       if (lhcost == INFINITY)
+                       if (lhcost == NC_INFINITY)
                            break;
                    }
 
@@ -770,8 +770,8 @@ relative_move(NCURSES_SP_DCLx
            }
        }
 
-       if (hcost == INFINITY)
-           return (INFINITY);
+       if (hcost == NC_INFINITY)
+           return (NC_INFINITY);
     }
 
     return (vcost + hcost);
@@ -798,7 +798,7 @@ onscreen_mvcur(NCURSES_SP_DCLx
 {
     string_desc result;
     char buffer[OPT_SIZE];
-    int tactic = 0, newcost, usecost = INFINITY;
+    int tactic = 0, newcost, usecost = NC_INFINITY;
     int t5_cr_cost;
 
 #if defined(MAIN) || defined(NCURSES_TEST)
@@ -846,7 +846,7 @@ onscreen_mvcur(NCURSES_SP_DCLx
        && ((newcost = relative_move(NCURSES_SP_ARGx
                                     NullResult,
                                     yold, xold,
-                                    ynew, xnew, ovw)) != INFINITY)
+                                    ynew, xnew, ovw)) != NC_INFINITY)
        && newcost < usecost) {
        tactic = 1;
        usecost = newcost;
@@ -857,7 +857,7 @@ onscreen_mvcur(NCURSES_SP_DCLx
        && ((newcost = relative_move(NCURSES_SP_ARGx
                                     NullResult,
                                     yold, 0,
-                                    ynew, xnew, ovw)) != INFINITY)
+                                    ynew, xnew, ovw)) != NC_INFINITY)
        && SP_PARM->_cr_cost + newcost < usecost) {
        tactic = 2;
        usecost = SP_PARM->_cr_cost + newcost;
@@ -868,7 +868,7 @@ onscreen_mvcur(NCURSES_SP_DCLx
        && ((newcost = relative_move(NCURSES_SP_ARGx
                                     NullResult,
                                     0, 0,
-                                    ynew, xnew, ovw)) != INFINITY)
+                                    ynew, xnew, ovw)) != NC_INFINITY)
        && SP_PARM->_home_cost + newcost < usecost) {
        tactic = 3;
        usecost = SP_PARM->_home_cost + newcost;
@@ -879,7 +879,7 @@ onscreen_mvcur(NCURSES_SP_DCLx
        && ((newcost = relative_move(NCURSES_SP_ARGx
                                     NullResult,
                                     screen_lines(SP_PARM) - 1, 0,
-                                    ynew, xnew, ovw)) != INFINITY)
+                                    ynew, xnew, ovw)) != NC_INFINITY)
        && SP_PARM->_ll_cost + newcost < usecost) {
        tactic = 4;
        usecost = SP_PARM->_ll_cost + newcost;
@@ -895,7 +895,7 @@ onscreen_mvcur(NCURSES_SP_DCLx
        && ((newcost = relative_move(NCURSES_SP_ARGx
                                     NullResult,
                                     yold - 1, screen_columns(SP_PARM) - 1,
-                                    ynew, xnew, ovw)) != INFINITY)
+                                    ynew, xnew, ovw)) != NC_INFINITY)
        && t5_cr_cost + SP_PARM->_cub1_cost + newcost < usecost) {
        tactic = 5;
        usecost = t5_cr_cost + SP_PARM->_cub1_cost + newcost;
@@ -956,7 +956,7 @@ onscreen_mvcur(NCURSES_SP_DCLx
                       (int) diff, diff / 288);
 #endif /* MAIN */
 
-    if (usecost != INFINITY) {
+    if (usecost != NC_INFINITY) {
        TR(TRACE_MOVE, ("mvcur tactic %d", tactic));
        TPUTS_TRACE("mvcur");
        NCURSES_SP_NAME(tputs) (NCURSES_SP_ARGx
diff --git a/ncurses/win32con/win_driver.c b/ncurses/win32con/win_driver.c
index e87f17732..2663d2e79 100644
--- a/ncurses/win32con/win_driver.c
+++ b/ncurses/win32con/win_driver.c
@@ -1463,7 +1463,7 @@ tdiff(FILETIME fstart, FILETIME fend)
 static int
 Adjust(int milliseconds, int diff)
 {
-    if (milliseconds != INFINITY) {
+    if (milliseconds != NC_INFINITY) {
        milliseconds -= diff;
        if (milliseconds < 0)
            milliseconds = 0;
@@ -1544,7 +1544,7 @@ console_twait(
                      milliseconds, mode));
 
     if (milliseconds < 0)
-       milliseconds = INFINITY;
+       milliseconds = NC_INFINITY;
 
     memset(&inp_rec, 0, sizeof(inp_rec));
 
-- 
2.30.2

Attachment: signature.asc
Description: PGP signature

Reply via email to