+2012-08-14 Paul Eggert <eggert@cs.ucla.edu>
+
+ 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 <rgm@gnu.org>
* bzrmerge.el (bzrmerge-resolve): Disable local eval:.
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
+2012-08-14 Paul Eggert <eggert@cs.ucla.edu>
+
+ * 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 <rgm@gnu.org>
* make-docfile.c (IF_LINT):
putc (')', out);
}
\f
-/* 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. */
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);
}
type = "EMACS_INT";
break;
case BOOLEAN:
- type = "int";
+ type = "bool";
break;
case LISP_OBJECT:
type = "Lisp_Object";
+2012-08-14 Paul Eggert <eggert@cs.ucla.edu>
+
+ 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 <cyd@gnu.org>
* character.c (Fcharacterp): Doc fix (Bug#12076).
#include <stdalign.h>
#include <stdarg.h>
+#include <stdbool.h>
#include <stddef.h>
#include <inttypes.h>
#include <limits.h>
struct Lisp_Boolfwd
{
enum Lisp_Fwd_Type type; /* = Lisp_Fwd_Bool */
- int *boolvar;
+ bool *boolvar;
};
/* Forwarding pointer to a Lisp_Object variable.
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);
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);
# endif
# define realloc xrealloc
+# include <stdbool.h>
# include <string.h>
/* Define the syntax stuff for \<, \>, etc. */
#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,