diff options
| author | Paul Eggert | 2012-08-14 10:45:25 -0700 |
|---|---|---|
| committer | Paul Eggert | 2012-08-14 10:45:25 -0700 |
| commit | f5d9e83a70335308d5c6d18d62a7ac94f4bd431c (patch) | |
| tree | fc8adfdc499d17f2cc5afba12a70a157d7463258 /lib-src | |
| parent | 4abcdac823a757bffc204f5eb074eb09ad69e58a (diff) | |
| download | emacs-f5d9e83a70335308d5c6d18d62a7ac94f4bd431c.tar.gz emacs-f5d9e83a70335308d5c6d18d62a7ac94f4bd431c.zip | |
Use bool for Emacs Lisp booleans.
This is more natural, and on my platform (GCC 4.7.1 x86-64) it
makes Emacs's text size .03% smaller and presumably a bit faster.
* admin/merge-gnulib (GNULIB_MODULES): Add stdbool. This documents a
new direct dependency; stdbool was already being used indirectly
via other gnulib modules.
* lib-src/make-docfile.c (enum global_type): Sort values roughly in
decreasing alignment, except put functions last.
(compare_globals): Use this new property of enum global_type.
(write_globals): Use bool, not int, for booleans.
* src/lisp.h: Include <stdbool.h>.
(struct Lisp_Boolfwd, defvar_bool):
* src/lread.c (defvar_bool): Use bool, not int, for Lisp booleans.
* src/regex.c [!emacs]: Include <stdbool.h>.
(false, true): Remove; <stdbool.h> does this for us now.
Diffstat (limited to 'lib-src')
| -rw-r--r-- | lib-src/ChangeLog | 7 | ||||
| -rw-r--r-- | lib-src/make-docfile.c | 20 |
2 files changed, 15 insertions, 12 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 98a7b2529b9..01248e59256 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2012-08-14 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | * make-docfile.c (enum global_type): Sort values roughly in | ||
| 4 | decreasing alignment, except put functions last. | ||
| 5 | (compare_globals): Use this new property of enum global_type. | ||
| 6 | (write_globals): Use bool, not int, for booleans. | ||
| 7 | |||
| 1 | 2012-08-10 Glenn Morris <rgm@gnu.org> | 8 | 2012-08-10 Glenn Morris <rgm@gnu.org> |
| 2 | 9 | ||
| 3 | * make-docfile.c (IF_LINT): | 10 | * make-docfile.c (IF_LINT): |
diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c index dafb7c0afd9..2654387fb37 100644 --- a/lib-src/make-docfile.c +++ b/lib-src/make-docfile.c | |||
| @@ -545,14 +545,15 @@ write_c_args (FILE *out, char *func, char *buf, int minargs, int maxargs) | |||
| 545 | putc (')', out); | 545 | putc (')', out); |
| 546 | } | 546 | } |
| 547 | 547 | ||
| 548 | /* The types of globals. */ | 548 | /* The types of globals. These are sorted roughly in decreasing alignment |
| 549 | order to avoid allocation gaps, except that functions are last. */ | ||
| 549 | enum global_type | 550 | enum global_type |
| 550 | { | 551 | { |
| 551 | FUNCTION, | 552 | INVALID, |
| 553 | LISP_OBJECT, | ||
| 552 | EMACS_INTEGER, | 554 | EMACS_INTEGER, |
| 553 | BOOLEAN, | 555 | BOOLEAN, |
| 554 | LISP_OBJECT, | 556 | FUNCTION, |
| 555 | INVALID | ||
| 556 | }; | 557 | }; |
| 557 | 558 | ||
| 558 | /* A single global. */ | 559 | /* A single global. */ |
| @@ -601,13 +602,8 @@ compare_globals (const void *a, const void *b) | |||
| 601 | const struct global *ga = a; | 602 | const struct global *ga = a; |
| 602 | const struct global *gb = b; | 603 | const struct global *gb = b; |
| 603 | 604 | ||
| 604 | if (ga->type == FUNCTION) | 605 | if (ga->type != gb->type) |
| 605 | { | 606 | return ga->type - gb->type; |
| 606 | if (gb->type != FUNCTION) | ||
| 607 | return 1; | ||
| 608 | } | ||
| 609 | else if (gb->type == FUNCTION) | ||
| 610 | return -1; | ||
| 611 | 607 | ||
| 612 | return strcmp (ga->name, gb->name); | 608 | return strcmp (ga->name, gb->name); |
| 613 | } | 609 | } |
| @@ -634,7 +630,7 @@ write_globals (void) | |||
| 634 | type = "EMACS_INT"; | 630 | type = "EMACS_INT"; |
| 635 | break; | 631 | break; |
| 636 | case BOOLEAN: | 632 | case BOOLEAN: |
| 637 | type = "int"; | 633 | type = "bool"; |
| 638 | break; | 634 | break; |
| 639 | case LISP_OBJECT: | 635 | case LISP_OBJECT: |
| 640 | type = "Lisp_Object"; | 636 | type = "Lisp_Object"; |