aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2018-08-31 09:13:31 -0700
committerPaul Eggert2018-08-31 09:15:49 -0700
commit222b5970c42c2b85df67042c0c5db198859b478a (patch)
treef75630f988959b58f3b863dbc2b25d5173641dfa /src
parentab871981125393d89202932284eda6e507bfc6fd (diff)
downloademacs-222b5970c42c2b85df67042c0c5db198859b478a.tar.gz
emacs-222b5970c42c2b85df67042c0c5db198859b478a.zip
Rename Emacs-specific INFINITY constants
Although these constants were not erroneous, as they were used only in modules that did not include <math.h>, it's less confusing to names that cannot be confused with the now-standard INFINITY macro. * src/dispextern.h (SCROLL_INFINITY): New constant. * src/dispnew.c, src/scroll.c (INFINITY): Remove. All uses replaced with SCROLL_INFINITY. * src/process.c (wait_reading_process_output): Rename private constant.
Diffstat (limited to 'src')
-rw-r--r--src/dispextern.h4
-rw-r--r--src/dispnew.c3
-rw-r--r--src/process.c10
-rw-r--r--src/scroll.c30
4 files changed, 22 insertions, 25 deletions
diff --git a/src/dispextern.h b/src/dispextern.h
index 9cc65f6a3d4..579665c2ff8 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -3569,6 +3569,10 @@ extern void create_tty_output (struct frame *);
3569extern struct terminal *init_tty (const char *, const char *, bool); 3569extern struct terminal *init_tty (const char *, const char *, bool);
3570extern void tty_append_glyph (struct it *); 3570extern void tty_append_glyph (struct it *);
3571 3571
3572/* All scrolling costs measured in characters.
3573 So no cost can exceed the area of a frame, measured in characters.
3574 Let's hope this is never more than 1000000 characters. */
3575enum { SCROLL_INFINITY = 1000000 };
3572 3576
3573/* Defined in scroll.c */ 3577/* Defined in scroll.c */
3574 3578
diff --git a/src/dispnew.c b/src/dispnew.c
index 61ca717079b..bd246799b23 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -4677,8 +4677,7 @@ scrolling (struct frame *frame)
4677 { 4677 {
4678 /* This line cannot be redrawn, so don't let scrolling mess it. */ 4678 /* This line cannot be redrawn, so don't let scrolling mess it. */
4679 new_hash[i] = old_hash[i]; 4679 new_hash[i] = old_hash[i];
4680#define INFINITY 1000000 /* Taken from scroll.c */ 4680 draw_cost[i] = SCROLL_INFINITY;
4681 draw_cost[i] = INFINITY;
4682 } 4681 }
4683 else 4682 else
4684 { 4683 {
diff --git a/src/process.c b/src/process.c
index 29cedd7ad69..ff81485d261 100644
--- a/src/process.c
+++ b/src/process.c
@@ -5009,7 +5009,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
5009 Lisp_Object proc; 5009 Lisp_Object proc;
5010 struct timespec timeout, end_time, timer_delay; 5010 struct timespec timeout, end_time, timer_delay;
5011 struct timespec got_output_end_time = invalid_timespec (); 5011 struct timespec got_output_end_time = invalid_timespec ();
5012 enum { MINIMUM = -1, TIMEOUT, INFINITY } wait; 5012 enum { MINIMUM = -1, TIMEOUT, FOREVER } wait;
5013 int got_some_output = -1; 5013 int got_some_output = -1;
5014 uintmax_t prev_wait_proc_nbytes_read = wait_proc ? wait_proc->nbytes_read : 0; 5014 uintmax_t prev_wait_proc_nbytes_read = wait_proc ? wait_proc->nbytes_read : 0;
5015#if defined HAVE_GETADDRINFO_A || defined HAVE_GNUTLS 5015#if defined HAVE_GETADDRINFO_A || defined HAVE_GNUTLS
@@ -5048,7 +5048,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
5048 end_time = timespec_add (now, make_timespec (time_limit, nsecs)); 5048 end_time = timespec_add (now, make_timespec (time_limit, nsecs));
5049 } 5049 }
5050 else 5050 else
5051 wait = INFINITY; 5051 wait = FOREVER;
5052 5052
5053 while (1) 5053 while (1)
5054 { 5054 {
@@ -7515,7 +7515,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
7515{ 7515{
7516 register int nfds; 7516 register int nfds;
7517 struct timespec end_time, timeout; 7517 struct timespec end_time, timeout;
7518 enum { MINIMUM = -1, TIMEOUT, INFINITY } wait; 7518 enum { MINIMUM = -1, TIMEOUT, FOREVER } wait;
7519 7519
7520 if (TYPE_MAXIMUM (time_t) < time_limit) 7520 if (TYPE_MAXIMUM (time_t) < time_limit)
7521 time_limit = TYPE_MAXIMUM (time_t); 7521 time_limit = TYPE_MAXIMUM (time_t);
@@ -7529,7 +7529,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
7529 make_timespec (time_limit, nsecs)); 7529 make_timespec (time_limit, nsecs));
7530 } 7530 }
7531 else 7531 else
7532 wait = INFINITY; 7532 wait = FOREVER;
7533 7533
7534 /* Turn off periodic alarms (in case they are in use) 7534 /* Turn off periodic alarms (in case they are in use)
7535 and then turn off any other atimers, 7535 and then turn off any other atimers,
@@ -7635,7 +7635,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
7635 /* If we woke up due to SIGWINCH, actually change size now. */ 7635 /* If we woke up due to SIGWINCH, actually change size now. */
7636 do_pending_window_change (0); 7636 do_pending_window_change (0);
7637 7637
7638 if (wait < INFINITY && nfds == 0 && ! timeout_reduced_for_timers) 7638 if (wait < FOREVER && nfds == 0 && ! timeout_reduced_for_timers)
7639 /* We waited the full specified time, so return now. */ 7639 /* We waited the full specified time, so return now. */
7640 break; 7640 break;
7641 7641
diff --git a/src/scroll.c b/src/scroll.c
index 8a53f9614f7..a29f2d37f54 100644
--- a/src/scroll.c
+++ b/src/scroll.c
@@ -28,12 +28,6 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
28#include "frame.h" 28#include "frame.h"
29#include "termhooks.h" 29#include "termhooks.h"
30 30
31/* All costs measured in characters.
32 So no cost can exceed the area of a frame, measured in characters.
33 Let's hope this is never more than 1000000 characters. */
34
35#define INFINITY 1000000
36
37struct matrix_elt 31struct matrix_elt
38 { 32 {
39 /* Cost of outputting through this line 33 /* Cost of outputting through this line
@@ -120,8 +114,8 @@ calculate_scrolling (struct frame *frame,
120 114
121 /* initialize the top left corner of the matrix */ 115 /* initialize the top left corner of the matrix */
122 matrix->writecost = 0; 116 matrix->writecost = 0;
123 matrix->insertcost = INFINITY; 117 matrix->insertcost = SCROLL_INFINITY;
124 matrix->deletecost = INFINITY; 118 matrix->deletecost = SCROLL_INFINITY;
125 matrix->insertcount = 0; 119 matrix->insertcount = 0;
126 matrix->deletecount = 0; 120 matrix->deletecount = 0;
127 121
@@ -132,8 +126,8 @@ calculate_scrolling (struct frame *frame,
132 p = matrix + i * (window_size + 1); 126 p = matrix + i * (window_size + 1);
133 cost += draw_cost[i] + next_insert_cost[i] + extra_cost; 127 cost += draw_cost[i] + next_insert_cost[i] + extra_cost;
134 p->insertcost = cost; 128 p->insertcost = cost;
135 p->writecost = INFINITY; 129 p->writecost = SCROLL_INFINITY;
136 p->deletecost = INFINITY; 130 p->deletecost = SCROLL_INFINITY;
137 p->insertcount = i; 131 p->insertcount = i;
138 p->deletecount = 0; 132 p->deletecount = 0;
139 } 133 }
@@ -144,8 +138,8 @@ calculate_scrolling (struct frame *frame,
144 { 138 {
145 cost += next_delete_cost[j]; 139 cost += next_delete_cost[j];
146 matrix[j].deletecost = cost; 140 matrix[j].deletecost = cost;
147 matrix[j].writecost = INFINITY; 141 matrix[j].writecost = SCROLL_INFINITY;
148 matrix[j].insertcost = INFINITY; 142 matrix[j].insertcost = SCROLL_INFINITY;
149 matrix[j].deletecount = j; 143 matrix[j].deletecount = j;
150 matrix[j].insertcount = 0; 144 matrix[j].insertcount = 0;
151 } 145 }
@@ -465,8 +459,8 @@ calculate_direct_scrolling (struct frame *frame,
465 459
466 /* initialize the top left corner of the matrix */ 460 /* initialize the top left corner of the matrix */
467 matrix->writecost = 0; 461 matrix->writecost = 0;
468 matrix->insertcost = INFINITY; 462 matrix->insertcost = SCROLL_INFINITY;
469 matrix->deletecost = INFINITY; 463 matrix->deletecost = SCROLL_INFINITY;
470 matrix->writecount = 0; 464 matrix->writecount = 0;
471 matrix->insertcount = 0; 465 matrix->insertcount = 0;
472 matrix->deletecount = 0; 466 matrix->deletecount = 0;
@@ -478,8 +472,8 @@ calculate_direct_scrolling (struct frame *frame,
478 p = matrix + i * (window_size + 1); 472 p = matrix + i * (window_size + 1);
479 cost += draw_cost[i]; 473 cost += draw_cost[i];
480 p->insertcost = cost; 474 p->insertcost = cost;
481 p->writecost = INFINITY; 475 p->writecost = SCROLL_INFINITY;
482 p->deletecost = INFINITY; 476 p->deletecost = SCROLL_INFINITY;
483 p->insertcount = i; 477 p->insertcount = i;
484 p->writecount = 0; 478 p->writecount = 0;
485 p->deletecount = 0; 479 p->deletecount = 0;
@@ -489,8 +483,8 @@ calculate_direct_scrolling (struct frame *frame,
489 for (j = 1; j <= window_size; j++) 483 for (j = 1; j <= window_size; j++)
490 { 484 {
491 matrix[j].deletecost = 0; 485 matrix[j].deletecost = 0;
492 matrix[j].writecost = INFINITY; 486 matrix[j].writecost = SCROLL_INFINITY;
493 matrix[j].insertcost = INFINITY; 487 matrix[j].insertcost = SCROLL_INFINITY;
494 matrix[j].deletecount = j; 488 matrix[j].deletecount = j;
495 matrix[j].writecount = 0; 489 matrix[j].writecount = 0;
496 matrix[j].insertcount = 0; 490 matrix[j].insertcount = 0;