emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r109793: * composite.c, data.c, dbusb


From: Paul Eggert
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r109793: * composite.c, data.c, dbusbind.c, dired.c: Use bool for booleans.
Date: Mon, 27 Aug 2012 10:23:48 -0700
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 109793
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Mon 2012-08-27 10:23:48 -0700
message:
  * composite.c, data.c, dbusbind.c, dired.c: Use bool for booleans.
  
  * composite.c (find_composition, composition_gstring_p)
  (composition_reseat_it, find_automatic_composition):
  * data.c (let_shadows_buffer_binding_p)
  (let_shadows_global_binding_p, set_internal, make_blv)
  (Fmake_variable_buffer_local, Fmake_local_variable)
  (Fmake_variable_frame_local, arithcompare, cons_to_unsigned)
  (cons_to_signed, arith_driver):
  * dbusbind.c (xd_in_read_queued_messages):
  * dired.c (directory_files_internal, file_name_completion):
  Use bool for booleans.
  * dired.c (file_name_completion):
  * process.h (fd_callback):
  Omit int (actually boolean) argument.  It wasn't being used.
  All uses changed.
  * composite.h, lisp.h: Reflect above API changes.
modified:
  src/ChangeLog
  src/composite.c
  src/composite.h
  src/data.c
  src/dbusbind.c
  src/dired.c
  src/lisp.h
  src/process.c
  src/process.h
  src/xsmfns.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-08-27 16:19:34 +0000
+++ b/src/ChangeLog     2012-08-27 17:23:48 +0000
@@ -1,5 +1,22 @@
 2012-08-27  Paul Eggert  <address@hidden>
 
+       * composite.c, data.c, dbusbind.c, dired.c: Use bool for booleans.
+       * composite.c (find_composition, composition_gstring_p)
+       (composition_reseat_it, find_automatic_composition):
+       * data.c (let_shadows_buffer_binding_p)
+       (let_shadows_global_binding_p, set_internal, make_blv)
+       (Fmake_variable_buffer_local, Fmake_local_variable)
+       (Fmake_variable_frame_local, arithcompare, cons_to_unsigned)
+       (cons_to_signed, arith_driver):
+       * dbusbind.c (xd_in_read_queued_messages):
+       * dired.c (directory_files_internal, file_name_completion):
+       Use bool for booleans.
+       * dired.c (file_name_completion):
+       * process.h (fd_callback):
+       Omit int (actually boolean) argument.  It wasn't being used.
+       All uses changed.
+       * composite.h, lisp.h: Reflect above API changes.
+
        * cmds.c, coding.c: Use bool for booleans.
        * cmds.c (move_point, Fself_insert_command):
        * coding.h (struct composition status, struct coding_system):

=== modified file 'src/composite.c'
--- a/src/composite.c   2012-08-07 07:33:18 +0000
+++ b/src/composite.c   2012-08-27 17:23:48 +0000
@@ -428,7 +428,7 @@
 
    This doesn't check the validity of composition.  */
 
-int
+bool
 find_composition (ptrdiff_t pos, ptrdiff_t limit,
                  ptrdiff_t *start, ptrdiff_t *end,
                  Lisp_Object *prop, Lisp_Object object)
@@ -709,7 +709,7 @@
                                         Lisp_Object, Lisp_Object,
                                         Lisp_Object);
 
-int
+bool
 composition_gstring_p (Lisp_Object gstring)
 {
   Lisp_Object header;
@@ -1212,11 +1212,13 @@
    string.  In that case, FACE must not be NULL.
 
    If the character is composed, setup members of CMP_IT (id, nglyphs,
-   from, to, reversed_p), and return 1.  Otherwise, update
-   CMP_IT->stop_pos, and return 0.  */
+   from, to, reversed_p), and return true.  Otherwise, update
+   CMP_IT->stop_pos, and return false.  */
 
-int
-composition_reseat_it (struct composition_it *cmp_it, ptrdiff_t charpos, 
ptrdiff_t bytepos, ptrdiff_t endpos, struct window *w, struct face *face, 
Lisp_Object string)
+bool
+composition_reseat_it (struct composition_it *cmp_it, ptrdiff_t charpos,
+                      ptrdiff_t bytepos, ptrdiff_t endpos, struct window *w,
+                      struct face *face, Lisp_Object string)
 {
   if (endpos < 0)
     endpos = NILP (string) ? BEGV : 0;
@@ -1482,10 +1484,10 @@
 /* This is like find_composition, but find an automatic composition
    instead.  It is assured that POS is not within a static
    composition.  If found, set *GSTRING to the glyph-string
-   representing the composition, and return 1.  Otherwise, *GSTRING to
-   Qnil, and return 0.  */
+   representing the composition, and return true.  Otherwise, *GSTRING to
+   Qnil, and return false.  */
 
-static int
+static bool
 find_automatic_composition (ptrdiff_t pos, ptrdiff_t limit,
                            ptrdiff_t *start, ptrdiff_t *end,
                            Lisp_Object *gstring, Lisp_Object string)
@@ -1498,7 +1500,7 @@
   int c;
   Lisp_Object window;
   struct window *w;
-  int need_adjustment = 0;
+  bool need_adjustment = 0;
 
   window = Fget_buffer_window (Fcurrent_buffer (), Qnil);
   if (NILP (window))

=== modified file 'src/composite.h'
--- a/src/composite.h   2012-08-02 07:31:34 +0000
+++ b/src/composite.h   2012-08-27 17:23:48 +0000
@@ -223,8 +223,8 @@
 extern Lisp_Object composition_hash_table;
 extern ptrdiff_t get_composition_id (ptrdiff_t, ptrdiff_t, ptrdiff_t,
                                     Lisp_Object, Lisp_Object);
-extern int find_composition (ptrdiff_t, ptrdiff_t, ptrdiff_t *, ptrdiff_t *,
-                            Lisp_Object *, Lisp_Object);
+extern bool find_composition (ptrdiff_t, ptrdiff_t, ptrdiff_t *, ptrdiff_t *,
+                             Lisp_Object *, Lisp_Object);
 extern void update_compositions (ptrdiff_t, ptrdiff_t, int);
 extern void make_composition_value_copy (Lisp_Object);
 extern void compose_region (int, int, Lisp_Object, Lisp_Object,
@@ -310,17 +310,16 @@
 
 extern Lisp_Object composition_gstring_put_cache (Lisp_Object, ptrdiff_t);
 extern Lisp_Object composition_gstring_from_id (ptrdiff_t);
-extern int composition_gstring_p (Lisp_Object);
+extern bool composition_gstring_p (Lisp_Object);
 extern int composition_gstring_width (Lisp_Object, ptrdiff_t, ptrdiff_t,
                                       struct font_metrics *);
 
 extern void composition_compute_stop_pos (struct composition_it *,
                                           ptrdiff_t, ptrdiff_t, ptrdiff_t,
                                           Lisp_Object);
-extern int composition_reseat_it (struct composition_it *,
-                                  ptrdiff_t, ptrdiff_t, ptrdiff_t,
-                                  struct window *, struct face *,
-                                  Lisp_Object);
+extern bool composition_reseat_it (struct composition_it *, ptrdiff_t,
+                                  ptrdiff_t, ptrdiff_t, struct window *,
+                                  struct face *, Lisp_Object);
 extern int composition_update_it (struct composition_it *,
                                   ptrdiff_t, ptrdiff_t, Lisp_Object);
 

=== modified file 'src/data.c'
--- a/src/data.c        2012-08-26 10:04:27 +0000
+++ b/src/data.c        2012-08-27 17:23:48 +0000
@@ -1080,10 +1080,10 @@
   return newval;
 }
 
-/* Return 1 if SYMBOL currently has a let-binding
+/* Return true if SYMBOL currently has a let-binding
    which was made in the buffer that is now current.  */
 
-static int
+static bool
 let_shadows_buffer_binding_p (struct Lisp_Symbol *symbol)
 {
   struct specbinding *p;
@@ -1102,7 +1102,7 @@
   return 0;
 }
 
-static int
+static bool
 let_shadows_global_binding_p (Lisp_Object symbol)
 {
   struct specbinding *p;
@@ -1118,14 +1118,15 @@
    If buffer/frame-locality is an issue, WHERE specifies which context to use.
    (nil stands for the current buffer/frame).
 
-   If BINDFLAG is zero, then if this symbol is supposed to become
+   If BINDFLAG is false, then if this symbol is supposed to become
    local in every buffer where it is set, then we make it local.
-   If BINDFLAG is nonzero, we don't do that.  */
+   If BINDFLAG is true, we don't do that.  */
 
 void
-set_internal (register Lisp_Object symbol, register Lisp_Object newval, 
register Lisp_Object where, int bindflag)
+set_internal (Lisp_Object symbol, Lisp_Object newval, Lisp_Object where,
+             bool bindflag)
 {
-  int voide = EQ (newval, Qunbound);
+  bool voide = EQ (newval, Qunbound);
   struct Lisp_Symbol *sym;
   Lisp_Object tem1;
 
@@ -1464,7 +1465,8 @@
   };
 
 static struct Lisp_Buffer_Local_Value *
-make_blv (struct Lisp_Symbol *sym, int forwarded, union Lisp_Val_Fwd 
valcontents)
+make_blv (struct Lisp_Symbol *sym, bool forwarded,
+         union Lisp_Val_Fwd valcontents)
 {
   struct Lisp_Buffer_Local_Value *blv = xmalloc (sizeof *blv);
   Lisp_Object symbol;
@@ -1508,7 +1510,7 @@
   struct Lisp_Symbol *sym;
   struct Lisp_Buffer_Local_Value *blv = NULL;
   union Lisp_Val_Fwd valcontents IF_LINT (= {LISP_INITIALLY_ZERO});
-  int forwarded IF_LINT (= 0);
+  bool forwarded IF_LINT (= 0);
 
   CHECK_SYMBOL (variable);
   sym = XSYMBOL (variable);
@@ -1580,10 +1582,10 @@
 
 Do not use `make-local-variable' to make a hook variable buffer-local.
 Instead, use `add-hook' and specify t for the LOCAL argument.  */)
-  (register Lisp_Object variable)
+  (Lisp_Object variable)
 {
-  register Lisp_Object tem;
-  int forwarded IF_LINT (= 0);
+  Lisp_Object tem;
+  bool forwarded IF_LINT (= 0);
   union Lisp_Val_Fwd valcontents IF_LINT (= {LISP_INITIALLY_ZERO});
   struct Lisp_Symbol *sym;
   struct Lisp_Buffer_Local_Value *blv = NULL;
@@ -1767,9 +1769,9 @@
 Note that since Emacs 23.1, variables cannot be both buffer-local and
 frame-local any more (buffer-local bindings used to take precedence over
 frame-local bindings).  */)
-  (register Lisp_Object variable)
+  (Lisp_Object variable)
 {
-  int forwarded;
+  bool forwarded;
   union Lisp_Val_Fwd valcontents;
   struct Lisp_Symbol *sym;
   struct Lisp_Buffer_Local_Value *blv = NULL;
@@ -2225,7 +2227,7 @@
 arithcompare (Lisp_Object num1, Lisp_Object num2, enum comparison comparison)
 {
   double f1 = 0, f2 = 0;
-  int floatp = 0;
+  bool floatp = 0;
 
   CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (num1);
   CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (num2);
@@ -2342,7 +2344,7 @@
 uintmax_t
 cons_to_unsigned (Lisp_Object c, uintmax_t max)
 {
-  int valid = 0;
+  bool valid = 0;
   uintmax_t val IF_LINT (= 0);
   if (INTEGERP (c))
     {
@@ -2395,7 +2397,7 @@
 intmax_t
 cons_to_signed (Lisp_Object c, intmax_t min, intmax_t max)
 {
-  int valid = 0;
+  bool valid = 0;
   intmax_t val IF_LINT (= 0);
   if (INTEGERP (c))
     {
@@ -2513,14 +2515,11 @@
 static Lisp_Object
 arith_driver (enum arithop code, ptrdiff_t nargs, Lisp_Object *args)
 {
-  register Lisp_Object val;
-  ptrdiff_t argnum;
-  register EMACS_INT accum = 0;
-  register EMACS_INT next;
-
-  int overflow = 0;
-  ptrdiff_t ok_args;
-  EMACS_INT ok_accum;
+  Lisp_Object val;
+  ptrdiff_t argnum, ok_args;
+  EMACS_INT accum = 0;
+  EMACS_INT next, ok_accum;
+  bool overflow = 0;
 
   switch (code)
     {

=== modified file 'src/dbusbind.c'
--- a/src/dbusbind.c    2012-08-21 16:54:50 +0000
+++ b/src/dbusbind.c    2012-08-27 17:23:48 +0000
@@ -70,7 +70,7 @@
 static Lisp_Object xd_registered_buses;
 
 /* Whether we are reading a D-Bus event.  */
-static int xd_in_read_queued_messages = 0;
+static bool xd_in_read_queued_messages = 0;
 
 
 /* We use "xd_" and "XD_" as prefix for all internal symbols, because
@@ -997,8 +997,7 @@
 }
 
 /* Prototype.  */
-static void
-xd_read_queued_messages (int fd, void *data, int for_read);
+static void xd_read_queued_messages (int fd, void *data);
 
 /* Start monitoring WATCH for possible I/O.  */
 static dbus_bool_t
@@ -1686,7 +1685,7 @@
 
 /* Callback called when something is ready to read or write.  */
 static void
-xd_read_queued_messages (int fd, void *data, int for_read)
+xd_read_queued_messages (int fd, void *data)
 {
   Lisp_Object busp = xd_registered_buses;
   Lisp_Object bus = Qnil;

=== modified file 'src/dired.c'
--- a/src/dired.c       2012-08-03 23:36:11 +0000
+++ b/src/dired.c       2012-08-27 17:23:48 +0000
@@ -109,18 +109,20 @@
 }
 
 /* Function shared by Fdirectory_files and Fdirectory_files_and_attributes.
-   When ATTRS is zero, return a list of directory filenames; when
-   non-zero, return a list of directory filenames and their attributes.
+   If not ATTRS, return a list of directory filenames;
+   if ATTRS, return a list of directory filenames and their attributes.
    In the latter case, ID_FORMAT is passed to Ffile_attributes.  */
 
 Lisp_Object
-directory_files_internal (Lisp_Object directory, Lisp_Object full, Lisp_Object 
match, Lisp_Object nosort, int attrs, Lisp_Object id_format)
+directory_files_internal (Lisp_Object directory, Lisp_Object full,
+                         Lisp_Object match, Lisp_Object nosort, bool attrs,
+                         Lisp_Object id_format)
 {
   DIR *d;
   ptrdiff_t directory_nbytes;
   Lisp_Object list, dirfilename, encoded_directory;
   struct re_pattern_buffer *bufp = NULL;
-  int needsep = 0;
+  bool needsep = 0;
   ptrdiff_t count = SPECPDL_INDEX ();
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
   DIRENTRY *dp;
@@ -227,7 +229,7 @@
       if (DIRENTRY_NONEMPTY (dp))
        {
          ptrdiff_t len;
-         int wanted = 0;
+         bool wanted = 0;
          Lisp_Object name, finalname;
          struct gcpro gcpro1, gcpro2;
 
@@ -381,9 +383,8 @@
 }
 
 
-static Lisp_Object file_name_completion
-  (Lisp_Object file, Lisp_Object dirname, int all_flag, int ver_flag,
-   Lisp_Object predicate);
+static Lisp_Object file_name_completion (Lisp_Object, Lisp_Object, bool,
+                                        Lisp_Object);
 
 DEFUN ("file-name-completion", Ffile_name_completion, Sfile_name_completion,
        2, 3, 0,
@@ -415,7 +416,7 @@
   if (!NILP (handler))
     return call4 (handler, Qfile_name_completion, file, directory, predicate);
 
-  return file_name_completion (file, directory, 0, 0, predicate);
+  return file_name_completion (file, directory, 0, predicate);
 }
 
 DEFUN ("file-name-all-completions", Ffile_name_all_completions,
@@ -439,14 +440,15 @@
   if (!NILP (handler))
     return call3 (handler, Qfile_name_all_completions, file, directory);
 
-  return file_name_completion (file, directory, 1, 0, Qnil);
+  return file_name_completion (file, directory, 1, Qnil);
 }
 
 static int file_name_completion_stat (Lisp_Object dirname, DIRENTRY *dp, 
struct stat *st_addr);
 static Lisp_Object Qdefault_directory;
 
 static Lisp_Object
-file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int 
ver_flag, Lisp_Object predicate)
+file_name_completion (Lisp_Object file, Lisp_Object dirname, bool all_flag,
+                     Lisp_Object predicate)
 {
   DIR *d;
   ptrdiff_t bestmatchsize = 0;
@@ -459,10 +461,10 @@
   Lisp_Object encoded_dir;
   struct stat st;
   int directoryp;
-  /* If includeall is zero, exclude files in completion-ignored-extensions as
+  /* If not INCLUDEALL, exclude files in completion-ignored-extensions as
      well as "." and "..".  Until shown otherwise, assume we can't exclude
      anything.  */
-  int includeall = 1;
+  bool includeall = 1;
   ptrdiff_t count = SPECPDL_INDEX ();
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
 
@@ -500,7 +502,7 @@
     {
       DIRENTRY *dp;
       ptrdiff_t len;
-      int canexclude = 0;
+      bool canexclude = 0;
 
       errno = 0;
       dp = readdir (d);

=== modified file 'src/lisp.h'
--- a/src/lisp.h        2012-08-27 16:19:34 +0000
+++ b/src/lisp.h        2012-08-27 17:23:48 +0000
@@ -2620,7 +2620,7 @@
                                           Lisp_Object);
 extern _Noreturn Lisp_Object wrong_type_argument (Lisp_Object, Lisp_Object);
 extern Lisp_Object do_symval_forwarding (union Lisp_Fwd *);
-extern void set_internal (Lisp_Object, Lisp_Object, Lisp_Object, int);
+extern void set_internal (Lisp_Object, Lisp_Object, Lisp_Object, bool);
 extern void syms_of_data (void);
 extern void init_data (void);
 extern void swap_in_global_binding (struct Lisp_Symbol *);
@@ -3434,7 +3434,7 @@
 extern void syms_of_dired (void);
 extern Lisp_Object directory_files_internal (Lisp_Object, Lisp_Object,
                                              Lisp_Object, Lisp_Object,
-                                             int, Lisp_Object);
+                                             bool, Lisp_Object);
 
 /* Defined in term.c */
 extern int *char_ins_del_vector;

=== modified file 'src/process.c'
--- a/src/process.c     2012-08-19 21:00:09 +0000
+++ b/src/process.c     2012-08-27 17:23:48 +0000
@@ -4870,15 +4870,13 @@
       for (channel = 0; channel <= max_input_desc; ++channel)
         {
           struct fd_callback_data *d = &fd_callback_info[channel];
-          if (FD_ISSET (channel, &Available)
-              && d->func != 0
-              && (d->condition & FOR_READ) != 0)
-            d->func (channel, d->data, 1);
-          if (FD_ISSET (channel, &write_mask)
-              && d->func != 0
-              && (d->condition & FOR_WRITE) != 0)
-            d->func (channel, d->data, 0);
-          }
+          if (d->func
+             && ((d->condition & FOR_READ
+                  && FD_ISSET (channel, &Available))
+                 || (d->condition & FOR_WRITE
+                     && FD_ISSET (channel, &write_mask))))
+            d->func (channel, d->data);
+       }
 
       for (channel = 0; channel <= max_process_desc; channel++)
        {

=== modified file 'src/process.h'
--- a/src/process.h     2012-08-25 03:11:12 +0000
+++ b/src/process.h     2012-08-27 17:23:48 +0000
@@ -219,7 +219,7 @@
 extern void unhold_keyboard_input (void);
 extern int kbd_on_hold_p (void);
 
-typedef void (*fd_callback)(int fd, void *data, int for_read);
+typedef void (*fd_callback) (int fd, void *data);
 
 extern void add_read_fd (int fd, fd_callback func, void *data);
 extern void delete_read_fd (int fd);

=== modified file 'src/xsmfns.c'
--- a/src/xsmfns.c      2012-01-19 07:21:25 +0000
+++ b/src/xsmfns.c      2012-08-27 17:23:48 +0000
@@ -97,7 +97,7 @@
    open to a session manager, just return.  */
 
 static void
-x_session_check_input (int fd, void *data, int for_read)
+x_session_check_input (int fd, void *data)
 {
   int ret;
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]