1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

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.
This commit is contained in:
Paul Eggert 2012-08-14 10:45:25 -07:00
parent 4abcdac823
commit f5d9e83a70
8 changed files with 39 additions and 18 deletions

View file

@ -545,14 +545,15 @@ write_c_args (FILE *out, char *func, char *buf, int minargs, int maxargs)
putc (')', out);
}
/* The types of globals. */
/* The types of globals. These are sorted roughly in decreasing alignment
order to avoid allocation gaps, except that functions are last. */
enum global_type
{
FUNCTION,
INVALID,
LISP_OBJECT,
EMACS_INTEGER,
BOOLEAN,
LISP_OBJECT,
INVALID
FUNCTION,
};
/* A single global. */
@ -601,13 +602,8 @@ compare_globals (const void *a, const void *b)
const struct global *ga = a;
const struct global *gb = b;
if (ga->type == FUNCTION)
{
if (gb->type != FUNCTION)
return 1;
}
else if (gb->type == FUNCTION)
return -1;
if (ga->type != gb->type)
return ga->type - gb->type;
return strcmp (ga->name, gb->name);
}
@ -634,7 +630,7 @@ write_globals (void)
type = "EMACS_INT";
break;
case BOOLEAN:
type = "int";
type = "bool";
break;
case LISP_OBJECT:
type = "Lisp_Object";