diff options
| author | Dmitry Antipov | 2014-10-03 08:35:10 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2014-10-03 08:35:10 +0400 |
| commit | 6846b0036a0ff938d93c2d4df0f177dab3e06623 (patch) | |
| tree | 58d57f74be7d3f7b9f4c01d7380528e6cbe63c30 /src | |
| parent | 11bd10a7df907289382bd6f06753e274376d7629 (diff) | |
| download | emacs-6846b0036a0ff938d93c2d4df0f177dab3e06623.tar.gz emacs-6846b0036a0ff938d93c2d4df0f177dab3e06623.zip | |
Consistently use min and max macros from lisp.h.
* coding.c (min, max):
* font.c (MAX):
* unexhp9k800.c (min):
* unexw32.c (min, max): Use definitions from lisp.h.
* regex.c (MAX, MIN) [!emacs]: Define own max and min as such.
Adjust users.
* gmalloc.c (min): Tiny style change.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 11 | ||||
| -rw-r--r-- | src/coding.c | 9 | ||||
| -rw-r--r-- | src/font.c | 6 | ||||
| -rw-r--r-- | src/gmalloc.c | 2 | ||||
| -rw-r--r-- | src/regex.c | 24 | ||||
| -rw-r--r-- | src/unexhp9k800.c | 1 | ||||
| -rw-r--r-- | src/unexw32.c | 5 |
7 files changed, 26 insertions, 32 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index f5f1d8e0458..6a4ef3a1dd9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,14 @@ | |||
| 1 | 2014-10-03 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 2 | |||
| 3 | Consistently use min and max macros from lisp.h. | ||
| 4 | * coding.c (min, max): | ||
| 5 | * font.c (MAX): | ||
| 6 | * unexhp9k800.c (min): | ||
| 7 | * unexw32.c (min, max): Use definitions from lisp.h. | ||
| 8 | * regex.c (MAX, MIN) [!emacs]: Define own max and min as such. | ||
| 9 | Adjust users. | ||
| 10 | * gmalloc.c (min): Tiny style change. | ||
| 11 | |||
| 1 | 2014-10-03 Paul Eggert <eggert@cs.ucla.edu> | 12 | 2014-10-03 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 13 | ||
| 3 | Fix x-focus-frame bug with "Not an in-range integer" (Bug#18586). | 14 | Fix x-focus-frame bug with "Not an in-range integer" (Bug#18586). |
diff --git a/src/coding.c b/src/coding.c index ed107a297ba..0337c0df60e 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -642,15 +642,6 @@ static enum coding_category coding_priorities[coding_category_max]; | |||
| 642 | Nth coding category. */ | 642 | Nth coding category. */ |
| 643 | static struct coding_system coding_categories[coding_category_max]; | 643 | static struct coding_system coding_categories[coding_category_max]; |
| 644 | 644 | ||
| 645 | /*** Commonly used macros and functions ***/ | ||
| 646 | |||
| 647 | #ifndef min | ||
| 648 | #define min(a, b) ((a) < (b) ? (a) : (b)) | ||
| 649 | #endif | ||
| 650 | #ifndef max | ||
| 651 | #define max(a, b) ((a) > (b) ? (a) : (b)) | ||
| 652 | #endif | ||
| 653 | |||
| 654 | /* Encode a flag that can be nil, something else, or t as -1, 0, 1. */ | 645 | /* Encode a flag that can be nil, something else, or t as -1, 0, 1. */ |
| 655 | 646 | ||
| 656 | static int | 647 | static int |
diff --git a/src/font.c b/src/font.c index 4d99087ef7d..8405065a0d0 100644 --- a/src/font.c +++ b/src/font.c | |||
| @@ -41,10 +41,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 41 | #include TERM_HEADER | 41 | #include TERM_HEADER |
| 42 | #endif /* HAVE_WINDOW_SYSTEM */ | 42 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 43 | 43 | ||
| 44 | #ifndef MAX | ||
| 45 | # define MAX(a, b) ((a) > (b) ? (a) : (b)) | ||
| 46 | #endif | ||
| 47 | |||
| 48 | Lisp_Object Qopentype; | 44 | Lisp_Object Qopentype; |
| 49 | 45 | ||
| 50 | /* Important character set strings. */ | 46 | /* Important character set strings. */ |
| @@ -1310,7 +1306,7 @@ font_unparse_xlfd (Lisp_Object font, int pixel_size, char *name, int nbytes) | |||
| 1310 | val = AREF (font, FONT_SIZE_INDEX); | 1306 | val = AREF (font, FONT_SIZE_INDEX); |
| 1311 | eassert (NUMBERP (val) || NILP (val)); | 1307 | eassert (NUMBERP (val) || NILP (val)); |
| 1312 | char font_size_index_buf[sizeof "-*" | 1308 | char font_size_index_buf[sizeof "-*" |
| 1313 | + MAX (INT_STRLEN_BOUND (EMACS_INT), | 1309 | + max (INT_STRLEN_BOUND (EMACS_INT), |
| 1314 | 1 + DBL_MAX_10_EXP + 1)]; | 1310 | 1 + DBL_MAX_10_EXP + 1)]; |
| 1315 | if (INTEGERP (val)) | 1311 | if (INTEGERP (val)) |
| 1316 | { | 1312 | { |
diff --git a/src/gmalloc.c b/src/gmalloc.c index 47046cc6747..3456ff0ec6f 100644 --- a/src/gmalloc.c +++ b/src/gmalloc.c | |||
| @@ -1303,7 +1303,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. | |||
| 1303 | or (US mail) as Mike Haertel c/o Free Software Foundation. */ | 1303 | or (US mail) as Mike Haertel c/o Free Software Foundation. */ |
| 1304 | 1304 | ||
| 1305 | #ifndef min | 1305 | #ifndef min |
| 1306 | #define min(A, B) ((A) < (B) ? (A) : (B)) | 1306 | #define min(a, b) ((a) < (b) ? (a) : (b)) |
| 1307 | #endif | 1307 | #endif |
| 1308 | 1308 | ||
| 1309 | /* Debugging hook for realloc. */ | 1309 | /* Debugging hook for realloc. */ |
diff --git a/src/regex.c b/src/regex.c index 9e9018bff88..766ad26e709 100644 --- a/src/regex.c +++ b/src/regex.c | |||
| @@ -515,10 +515,12 @@ init_syntax_once (void) | |||
| 515 | 515 | ||
| 516 | #define STREQ(s1, s2) ((strcmp (s1, s2) == 0)) | 516 | #define STREQ(s1, s2) ((strcmp (s1, s2) == 0)) |
| 517 | 517 | ||
| 518 | #undef MAX | 518 | #ifndef emacs |
| 519 | #undef MIN | 519 | # undef max |
| 520 | #define MAX(a, b) ((a) > (b) ? (a) : (b)) | 520 | # undef min |
| 521 | #define MIN(a, b) ((a) < (b) ? (a) : (b)) | 521 | # define max(a, b) ((a) > (b) ? (a) : (b)) |
| 522 | # define min(a, b) ((a) < (b) ? (a) : (b)) | ||
| 523 | #endif | ||
| 522 | 524 | ||
| 523 | /* Type of source-pattern and string chars. */ | 525 | /* Type of source-pattern and string chars. */ |
| 524 | #ifdef _MSC_VER | 526 | #ifdef _MSC_VER |
| @@ -1394,14 +1396,14 @@ typedef struct | |||
| 1394 | : ((fail_stack).stack \ | 1396 | : ((fail_stack).stack \ |
| 1395 | = REGEX_REALLOCATE_STACK ((fail_stack).stack, \ | 1397 | = REGEX_REALLOCATE_STACK ((fail_stack).stack, \ |
| 1396 | (fail_stack).size * sizeof (fail_stack_elt_t), \ | 1398 | (fail_stack).size * sizeof (fail_stack_elt_t), \ |
| 1397 | MIN (re_max_failures * TYPICAL_FAILURE_SIZE, \ | 1399 | min (re_max_failures * TYPICAL_FAILURE_SIZE, \ |
| 1398 | ((fail_stack).size * sizeof (fail_stack_elt_t) \ | 1400 | ((fail_stack).size * sizeof (fail_stack_elt_t) \ |
| 1399 | * FAIL_STACK_GROWTH_FACTOR))), \ | 1401 | * FAIL_STACK_GROWTH_FACTOR))), \ |
| 1400 | \ | 1402 | \ |
| 1401 | (fail_stack).stack == NULL \ | 1403 | (fail_stack).stack == NULL \ |
| 1402 | ? 0 \ | 1404 | ? 0 \ |
| 1403 | : ((fail_stack).size \ | 1405 | : ((fail_stack).size \ |
| 1404 | = (MIN (re_max_failures * TYPICAL_FAILURE_SIZE, \ | 1406 | = (min (re_max_failures * TYPICAL_FAILURE_SIZE, \ |
| 1405 | ((fail_stack).size * sizeof (fail_stack_elt_t) \ | 1407 | ((fail_stack).size * sizeof (fail_stack_elt_t) \ |
| 1406 | * FAIL_STACK_GROWTH_FACTOR)) \ | 1408 | * FAIL_STACK_GROWTH_FACTOR)) \ |
| 1407 | / sizeof (fail_stack_elt_t)), \ | 1409 | / sizeof (fail_stack_elt_t)), \ |
| @@ -2309,8 +2311,8 @@ set_image_of_range (struct range_table_work_area *work_area, | |||
| 2309 | cmin = c, cmax = c; | 2311 | cmin = c, cmax = c; |
| 2310 | else | 2312 | else |
| 2311 | { | 2313 | { |
| 2312 | cmin = MIN (cmin, c); | 2314 | cmin = min (cmin, c); |
| 2313 | cmax = MAX (cmax, c); | 2315 | cmax = max (cmax, c); |
| 2314 | } | 2316 | } |
| 2315 | } | 2317 | } |
| 2316 | } | 2318 | } |
| @@ -2989,7 +2991,7 @@ regex_compile (const_re_char *pattern, size_t size, reg_syntax_t syntax, | |||
| 2989 | #else /* emacs */ | 2991 | #else /* emacs */ |
| 2990 | if (c < 128) | 2992 | if (c < 128) |
| 2991 | { | 2993 | { |
| 2992 | ch = MIN (127, c1); | 2994 | ch = min (127, c1); |
| 2993 | SETUP_ASCII_RANGE (range_table_work, c, ch); | 2995 | SETUP_ASCII_RANGE (range_table_work, c, ch); |
| 2994 | c = ch + 1; | 2996 | c = ch + 1; |
| 2995 | if (CHAR_BYTE8_P (c1)) | 2997 | if (CHAR_BYTE8_P (c1)) |
| @@ -5210,7 +5212,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const_re_char *string1, | |||
| 5210 | { /* No. So allocate them with malloc. We need one | 5212 | { /* No. So allocate them with malloc. We need one |
| 5211 | extra element beyond `num_regs' for the `-1' marker | 5213 | extra element beyond `num_regs' for the `-1' marker |
| 5212 | GNU code uses. */ | 5214 | GNU code uses. */ |
| 5213 | regs->num_regs = MAX (RE_NREGS, num_regs + 1); | 5215 | regs->num_regs = max (RE_NREGS, num_regs + 1); |
| 5214 | regs->start = TALLOC (regs->num_regs, regoff_t); | 5216 | regs->start = TALLOC (regs->num_regs, regoff_t); |
| 5215 | regs->end = TALLOC (regs->num_regs, regoff_t); | 5217 | regs->end = TALLOC (regs->num_regs, regoff_t); |
| 5216 | if (regs->start == NULL || regs->end == NULL) | 5218 | if (regs->start == NULL || regs->end == NULL) |
| @@ -5254,7 +5256,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const_re_char *string1, | |||
| 5254 | 5256 | ||
| 5255 | /* Go through the first `min (num_regs, regs->num_regs)' | 5257 | /* Go through the first `min (num_regs, regs->num_regs)' |
| 5256 | registers, since that is all we initialized. */ | 5258 | registers, since that is all we initialized. */ |
| 5257 | for (reg = 1; reg < MIN (num_regs, regs->num_regs); reg++) | 5259 | for (reg = 1; reg < min (num_regs, regs->num_regs); reg++) |
| 5258 | { | 5260 | { |
| 5259 | if (REG_UNSET (regstart[reg]) || REG_UNSET (regend[reg])) | 5261 | if (REG_UNSET (regstart[reg]) || REG_UNSET (regend[reg])) |
| 5260 | regs->start[reg] = regs->end[reg] = -1; | 5262 | regs->start[reg] = regs->end[reg] = -1; |
diff --git a/src/unexhp9k800.c b/src/unexhp9k800.c index 55db8071b76..cbf1835b9ee 100644 --- a/src/unexhp9k800.c +++ b/src/unexhp9k800.c | |||
| @@ -72,7 +72,6 @@ run_time_remap (char *ignored) | |||
| 72 | 72 | ||
| 73 | #undef roundup | 73 | #undef roundup |
| 74 | #define roundup(x,n) (((x) + ((n) - 1)) & ~((n) - 1)) /* n is power of 2 */ | 74 | #define roundup(x,n) (((x) + ((n) - 1)) & ~((n) - 1)) /* n is power of 2 */ |
| 75 | #define min(x,y) (((x) < (y)) ? (x) : (y)) | ||
| 76 | 75 | ||
| 77 | /* Report a fatal error and exit. */ | 76 | /* Report a fatal error and exit. */ |
| 78 | static _Noreturn void | 77 | static _Noreturn void |
diff --git a/src/unexw32.c b/src/unexw32.c index 95c805d09ae..5c1c1f3f391 100644 --- a/src/unexw32.c +++ b/src/unexw32.c | |||
| @@ -48,11 +48,6 @@ extern char *my_begbss_static; | |||
| 48 | 48 | ||
| 49 | #include "w32heap.h" | 49 | #include "w32heap.h" |
| 50 | 50 | ||
| 51 | #undef min | ||
| 52 | #undef max | ||
| 53 | #define min(x, y) (((x) < (y)) ? (x) : (y)) | ||
| 54 | #define max(x, y) (((x) > (y)) ? (x) : (y)) | ||
| 55 | |||
| 56 | /* Basically, our "initialized" flag. */ | 51 | /* Basically, our "initialized" flag. */ |
| 57 | BOOL using_dynamic_heap = FALSE; | 52 | BOOL using_dynamic_heap = FALSE; |
| 58 | 53 | ||