[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r109613: Use bool for Emacs Lisp bool
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r109613: Use bool for Emacs Lisp booleans. |
Date: |
Tue, 14 Aug 2012 10:45:25 -0700 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 109613
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Tue 2012-08-14 10:45:25 -0700
message:
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.
modified:
admin/ChangeLog
admin/merge-gnulib
lib-src/ChangeLog
lib-src/make-docfile.c
src/ChangeLog
src/lisp.h
src/lread.c
src/regex.c
=== modified file 'admin/ChangeLog'
--- a/admin/ChangeLog 2012-08-11 04:46:38 +0000
+++ b/admin/ChangeLog 2012-08-14 17:45:25 +0000
@@ -1,3 +1,10 @@
+2012-08-14 Paul Eggert <address@hidden>
+
+ Use bool for Emacs Lisp booleans.
+ * merge-gnulib (GNULIB_MODULES): Add stdbool. This documents a
+ new direct dependency; stdbool was already being used indirectly
+ via other gnulib modules.
+
2012-08-11 Glenn Morris <address@hidden>
* bzrmerge.el (bzrmerge-resolve): Disable local eval:.
=== modified file 'admin/merge-gnulib'
--- a/admin/merge-gnulib 2012-07-28 23:05:32 +0000
+++ b/admin/merge-gnulib 2012-08-14 17:45:25 +0000
@@ -32,7 +32,7 @@
filemode getloadavg getopt-gnu gettime gettimeofday
ignore-value intprops largefile lstat
manywarnings mktime pselect pthread_sigmask readlink
- socklen stat-time stdalign stdarg stdio
+ socklen stat-time stdalign stdarg stdbool stdio
strftime strtoimax strtoumax symlink sys_stat
sys_time time timespec-add timespec-sub utimens
warnings
=== modified file 'lib-src/ChangeLog'
--- a/lib-src/ChangeLog 2012-08-10 18:23:45 +0000
+++ b/lib-src/ChangeLog 2012-08-14 17:45:25 +0000
@@ -1,3 +1,10 @@
+2012-08-14 Paul Eggert <address@hidden>
+
+ * 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.
+
2012-08-10 Glenn Morris <address@hidden>
* make-docfile.c (IF_LINT):
=== modified file 'lib-src/make-docfile.c'
--- a/lib-src/make-docfile.c 2012-08-10 18:23:45 +0000
+++ b/lib-src/make-docfile.c 2012-08-14 17:45:25 +0000
@@ -545,14 +545,15 @@
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 @@
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 @@
type = "EMACS_INT";
break;
case BOOLEAN:
- type = "int";
+ type = "bool";
break;
case LISP_OBJECT:
type = "Lisp_Object";
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2012-08-14 17:10:38 +0000
+++ b/src/ChangeLog 2012-08-14 17:45:25 +0000
@@ -1,3 +1,14 @@
+2012-08-14 Paul Eggert <address@hidden>
+
+ Use bool, not int, for Lisp booleans.
+ This is more natural, and on my platform (GCC 4.7.1 x86-64) it
+ makes Emacs a bit smaller and presumably a bit faster.
+ * lisp.h: Include <stdbool.h>.
+ (struct Lisp_Boolfwd, defvar_bool):
+ * lread.c (defvar_bool): Use bool, not int, for Lisp booleans.
+ * regex.c [!emacs]: Include <stdbool.h>.
+ (false, true): Remove; <stdbool.h> does this for us now.
+
2012-08-14 Chong Yidong <address@hidden>
* character.c (Fcharacterp): Doc fix (Bug#12076).
=== modified file 'src/lisp.h'
--- a/src/lisp.h 2012-08-14 12:11:59 +0000
+++ b/src/lisp.h 2012-08-14 17:45:25 +0000
@@ -22,6 +22,7 @@
#include <stdalign.h>
#include <stdarg.h>
+#include <stdbool.h>
#include <stddef.h>
#include <inttypes.h>
#include <limits.h>
@@ -1394,7 +1395,7 @@
struct Lisp_Boolfwd
{
enum Lisp_Fwd_Type type; /* = Lisp_Fwd_Bool */
- int *boolvar;
+ bool *boolvar;
};
/* Forwarding pointer to a Lisp_Object variable.
@@ -1929,7 +1930,7 @@
extern void defvar_lisp (struct Lisp_Objfwd *, const char *, Lisp_Object *);
extern void defvar_lisp_nopro (struct Lisp_Objfwd *, const char *, Lisp_Object
*);
-extern void defvar_bool (struct Lisp_Boolfwd *, const char *, int *);
+extern void defvar_bool (struct Lisp_Boolfwd *, const char *, bool *);
extern void defvar_int (struct Lisp_Intfwd *, const char *, EMACS_INT *);
extern void defvar_kboard (struct Lisp_Kboard_Objfwd *, const char *, int);
=== modified file 'src/lread.c'
--- a/src/lread.c 2012-08-11 15:34:01 +0000
+++ b/src/lread.c 2012-08-14 17:45:25 +0000
@@ -3987,7 +3987,7 @@
nil if address contains 0. */
void
defvar_bool (struct Lisp_Boolfwd *b_fwd,
- const char *namestring, int *address)
+ const char *namestring, bool *address)
{
Lisp_Object sym;
sym = intern_c_string (namestring);
=== modified file 'src/regex.c'
--- a/src/regex.c 2012-07-30 18:56:42 +0000
+++ b/src/regex.c 2012-08-14 17:45:25 +0000
@@ -248,6 +248,7 @@
# endif
# define realloc xrealloc
+# include <stdbool.h>
# include <string.h>
/* Define the syntax stuff for \<, \>, etc. */
@@ -535,8 +536,6 @@
#endif
typedef char boolean;
-#define false 0
-#define true 1
static regoff_t re_match_2_internal (struct re_pattern_buffer *bufp,
re_char *string1, size_t size1,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r109613: Use bool for Emacs Lisp booleans.,
Paul Eggert <=