aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2012-08-14 10:45:25 -0700
committerPaul Eggert2012-08-14 10:45:25 -0700
commitf5d9e83a70335308d5c6d18d62a7ac94f4bd431c (patch)
treefc8adfdc499d17f2cc5afba12a70a157d7463258 /src
parent4abcdac823a757bffc204f5eb074eb09ad69e58a (diff)
downloademacs-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 'src')
-rw-r--r--src/ChangeLog11
-rw-r--r--src/lisp.h5
-rw-r--r--src/lread.c2
-rw-r--r--src/regex.c3
4 files changed, 16 insertions, 5 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 956d6922d2e..ed711b3a663 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,14 @@
12012-08-14 Paul Eggert <eggert@cs.ucla.edu>
2
3 Use bool, not int, for Lisp booleans.
4 This is more natural, and on my platform (GCC 4.7.1 x86-64) it
5 makes Emacs a bit smaller and presumably a bit faster.
6 * lisp.h: Include <stdbool.h>.
7 (struct Lisp_Boolfwd, defvar_bool):
8 * lread.c (defvar_bool): Use bool, not int, for Lisp booleans.
9 * regex.c [!emacs]: Include <stdbool.h>.
10 (false, true): Remove; <stdbool.h> does this for us now.
11
12012-08-14 Chong Yidong <cyd@gnu.org> 122012-08-14 Chong Yidong <cyd@gnu.org>
2 13
3 * character.c (Fcharacterp): Doc fix (Bug#12076). 14 * character.c (Fcharacterp): Doc fix (Bug#12076).
diff --git a/src/lisp.h b/src/lisp.h
index f6aa46d3f41..a0d47b3895e 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -22,6 +22,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
22 22
23#include <stdalign.h> 23#include <stdalign.h>
24#include <stdarg.h> 24#include <stdarg.h>
25#include <stdbool.h>
25#include <stddef.h> 26#include <stddef.h>
26#include <inttypes.h> 27#include <inttypes.h>
27#include <limits.h> 28#include <limits.h>
@@ -1394,7 +1395,7 @@ struct Lisp_Intfwd
1394struct Lisp_Boolfwd 1395struct Lisp_Boolfwd
1395 { 1396 {
1396 enum Lisp_Fwd_Type type; /* = Lisp_Fwd_Bool */ 1397 enum Lisp_Fwd_Type type; /* = Lisp_Fwd_Bool */
1397 int *boolvar; 1398 bool *boolvar;
1398 }; 1399 };
1399 1400
1400/* Forwarding pointer to a Lisp_Object variable. 1401/* Forwarding pointer to a Lisp_Object variable.
@@ -1929,7 +1930,7 @@ enum maxargs
1929 1930
1930extern void defvar_lisp (struct Lisp_Objfwd *, const char *, Lisp_Object *); 1931extern void defvar_lisp (struct Lisp_Objfwd *, const char *, Lisp_Object *);
1931extern void defvar_lisp_nopro (struct Lisp_Objfwd *, const char *, Lisp_Object *); 1932extern void defvar_lisp_nopro (struct Lisp_Objfwd *, const char *, Lisp_Object *);
1932extern void defvar_bool (struct Lisp_Boolfwd *, const char *, int *); 1933extern void defvar_bool (struct Lisp_Boolfwd *, const char *, bool *);
1933extern void defvar_int (struct Lisp_Intfwd *, const char *, EMACS_INT *); 1934extern void defvar_int (struct Lisp_Intfwd *, const char *, EMACS_INT *);
1934extern void defvar_kboard (struct Lisp_Kboard_Objfwd *, const char *, int); 1935extern void defvar_kboard (struct Lisp_Kboard_Objfwd *, const char *, int);
1935 1936
diff --git a/src/lread.c b/src/lread.c
index 3dd13c37f44..72991e92bae 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -3987,7 +3987,7 @@ defvar_int (struct Lisp_Intfwd *i_fwd,
3987 nil if address contains 0. */ 3987 nil if address contains 0. */
3988void 3988void
3989defvar_bool (struct Lisp_Boolfwd *b_fwd, 3989defvar_bool (struct Lisp_Boolfwd *b_fwd,
3990 const char *namestring, int *address) 3990 const char *namestring, bool *address)
3991{ 3991{
3992 Lisp_Object sym; 3992 Lisp_Object sym;
3993 sym = intern_c_string (namestring); 3993 sym = intern_c_string (namestring);
diff --git a/src/regex.c b/src/regex.c
index afe3751ea5e..472ef727979 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -248,6 +248,7 @@ xrealloc (void *block, size_t size)
248# endif 248# endif
249# define realloc xrealloc 249# define realloc xrealloc
250 250
251# include <stdbool.h>
251# include <string.h> 252# include <string.h>
252 253
253/* Define the syntax stuff for \<, \>, etc. */ 254/* Define the syntax stuff for \<, \>, etc. */
@@ -535,8 +536,6 @@ typedef const unsigned char re_char;
535#endif 536#endif
536 537
537typedef char boolean; 538typedef char boolean;
538#define false 0
539#define true 1
540 539
541static regoff_t re_match_2_internal (struct re_pattern_buffer *bufp, 540static regoff_t re_match_2_internal (struct re_pattern_buffer *bufp,
542 re_char *string1, size_t size1, 541 re_char *string1, size_t size1,