emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r111977: region-cache.c, scroll.c, se


From: Paul Eggert
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r111977: region-cache.c, scroll.c, search.c: Use bool for booleans.
Date: Fri, 08 Mar 2013 13:37:41 -0800
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111977
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Fri 2013-03-08 13:37:41 -0800
message:
  region-cache.c, scroll.c, search.c: Use bool for booleans.
  
  * lisp.h (compile_pattern):
  * scroll.c (do_scrolling, do_direct_scrolling):
  * search.c (struct regexp_cache, compile_pattern_1)
  (compile_pattern, string_match_1, search_command)
  (trivial_regexp_p, search_buffer, Freplace_match, match_limit)
  (search_regs_saved, Fregexp_quote):
  Use bool for boolean.
  * region-cache.c (region_cache_forward, region_cache_backward):
  Fix comments to match code: these functions return int, not boolean.
modified:
  src/ChangeLog
  src/lisp.h
  src/region-cache.c
  src/scroll.c
  src/search.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-03-08 09:34:35 +0000
+++ b/src/ChangeLog     2013-03-08 21:37:41 +0000
@@ -1,3 +1,16 @@
+2013-03-08  Paul Eggert  <address@hidden>
+
+       region-cache.c, scroll.c, search.c: Use bool for booleans.
+       * lisp.h (compile_pattern):
+       * scroll.c (do_scrolling, do_direct_scrolling):
+       * search.c (struct regexp_cache, compile_pattern_1)
+       (compile_pattern, string_match_1, search_command)
+       (trivial_regexp_p, search_buffer, Freplace_match, match_limit)
+       (search_regs_saved, Fregexp_quote):
+       Use bool for boolean.
+       * region-cache.c (region_cache_forward, region_cache_backward):
+       Fix comments to match code: these functions return int, not boolean.
+
 2013-03-08  Dmitry Antipov  <address@hidden>
 
        * search.c (find_newline): Accept start and end byte positions

=== modified file 'src/lisp.h'
--- a/src/lisp.h        2013-03-08 09:34:35 +0000
+++ b/src/lisp.h        2013-03-08 21:37:41 +0000
@@ -3357,7 +3357,7 @@
 struct re_registers;
 extern struct re_pattern_buffer *compile_pattern (Lisp_Object,
                                                  struct re_registers *,
-                                                 Lisp_Object, int, bool);
+                                                 Lisp_Object, bool, bool);
 extern ptrdiff_t fast_string_match (Lisp_Object, Lisp_Object);
 extern ptrdiff_t fast_c_string_match_ignore_case (Lisp_Object, const char *,
                                                  ptrdiff_t);

=== modified file 'src/region-cache.c'
--- a/src/region-cache.c        2013-01-01 09:11:05 +0000
+++ b/src/region-cache.c        2013-03-08 21:37:41 +0000
@@ -695,8 +695,9 @@
 
 /* Interface: using the cache.  */
 
-/* Return true if the text immediately after POS in BUF is known, for
-   the purposes of CACHE.  If NEXT is non-zero, set *NEXT to the nearest
+/* Return the value for the text immediately after POS in BUF if the value
+   is known, for the purposes of CACHE, and return zero otherwise.
+   If NEXT is non-zero, set *NEXT to the nearest
    position after POS where the knowledge changes.  */
 int
 region_cache_forward (struct buffer *buf, struct region_cache *c,
@@ -732,8 +733,9 @@
   }
 }
 
-/* Return true if the text immediately before POS in BUF is known, for
-   the purposes of CACHE.  If NEXT is non-zero, set *NEXT to the nearest
+/* Return the value for the text immediately before POS in BUF if the
+   value is known, for the purposes of CACHE, and return zero
+   otherwise.  If NEXT is non-zero, set *NEXT to the nearest
    position before POS where the knowledge changes.  */
 int region_cache_backward (struct buffer *buf, struct region_cache *c,
                           ptrdiff_t pos, ptrdiff_t *next)

=== modified file 'src/scroll.c'
--- a/src/scroll.c      2013-01-01 09:11:05 +0000
+++ b/src/scroll.c      2013-03-08 21:37:41 +0000
@@ -246,9 +246,8 @@
   struct matrix_elt *p;
   int i, j, k;
 
-  /* Set to 1 if we have set a terminal window with
-     set_terminal_window.  It's unsigned to work around GCC bug 48228.  */
-  unsigned int terminal_window_p = 0;
+  /* True if we have set a terminal window with set_terminal_window.  */
+  bool terminal_window_p = 0;
 
   /* A queue for line insertions to be done.  */
   struct queue { int count, pos; };
@@ -657,18 +656,16 @@
     alloca (window_size * sizeof *queue_start);
   struct alt_queue *queue = queue_start;
 
-  /* Set to 1 if a terminal window has been set with
-     set_terminal_window: */
-  int terminal_window_p = 0;
+  /* True if a terminal window has been set with set_terminal_window.  */
+  bool terminal_window_p = 0;
 
-  /* A nonzero value of write_follows indicates that a write has been
-     selected, allowing either an insert or a delete to be selected
-     next.  When write_follows is zero, a delete cannot be selected
+  /* If true, a write has been selected, allowing either an insert or a
+     delete to be selected next.  If false, a delete cannot be selected
      unless j < i, and an insert cannot be selected unless i < j.
      This corresponds to a similar restriction (with the ordering
      reversed) in calculate_direct_scrolling, which is intended to
      ensure that lines marked as inserted will be blank. */
-  int write_follows_p = 1;
+  bool write_follows_p = 1;
 
   /* For each row in the new matrix what row of the old matrix it is.  */
   int *copy_from = alloca (window_size * sizeof *copy_from);

=== modified file 'src/search.c'
--- a/src/search.c      2013-03-08 09:34:35 +0000
+++ b/src/search.c      2013-03-08 21:37:41 +0000
@@ -49,8 +49,8 @@
   Lisp_Object syntax_table;
   struct re_pattern_buffer buf;
   char fastmap[0400];
-  /* Nonzero means regexp was compiled to do full POSIX backtracking.  */
-  char posix;
+  /* True means regexp was compiled to do full POSIX backtracking.  */
+  bool posix;
 };
 
 /* The instances of that struct.  */
@@ -100,7 +100,7 @@
                               ptrdiff_t, int);
 static EMACS_INT search_buffer (Lisp_Object, ptrdiff_t, ptrdiff_t,
                                 ptrdiff_t, ptrdiff_t, EMACS_INT, int,
-                                Lisp_Object, Lisp_Object, int);
+                                Lisp_Object, Lisp_Object, bool);
 
 static _Noreturn void
 matcher_overflow (void)
@@ -112,13 +112,14 @@
    PATTERN is the pattern to compile.
    CP is the place to put the result.
    TRANSLATE is a translation table for ignoring case, or nil for none.
-   POSIX is nonzero if we want full backtracking (POSIX style)
-   for this pattern.  0 means backtrack only enough to get a valid match.
+   POSIX is true if we want full backtracking (POSIX style) for this pattern.
+   False means backtrack only enough to get a valid match.
 
    The behavior also depends on Vsearch_spaces_regexp.  */
 
 static void
-compile_pattern_1 (struct regexp_cache *cp, Lisp_Object pattern, Lisp_Object 
translate, int posix)
+compile_pattern_1 (struct regexp_cache *cp, Lisp_Object pattern,
+                  Lisp_Object translate, bool posix)
 {
   char *val;
   reg_syntax_t old;
@@ -205,12 +206,12 @@
    values that will result from matching this pattern.
    If it is 0, we should compile the pattern not to record any
    subexpression bounds.
-   POSIX is nonzero if we want full backtracking (POSIX style)
-   for this pattern.  0 means backtrack only enough to get a valid match.  */
+   POSIX is true if we want full backtracking (POSIX style) for this pattern.
+   False means backtrack only enough to get a valid match.  */
 
 struct re_pattern_buffer *
 compile_pattern (Lisp_Object pattern, struct re_registers *regp,
-                Lisp_Object translate, int posix, bool multibyte)
+                Lisp_Object translate, bool posix, bool multibyte)
 {
   struct regexp_cache *cp, **cpp;
 
@@ -267,7 +268,7 @@
 
 
 static Lisp_Object
-looking_at_1 (Lisp_Object string, int posix)
+looking_at_1 (Lisp_Object string, bool posix)
 {
   Lisp_Object val;
   unsigned char *p1, *p2;
@@ -365,7 +366,8 @@
 }
 
 static Lisp_Object
-string_match_1 (Lisp_Object regexp, Lisp_Object string, Lisp_Object start, int 
posix)
+string_match_1 (Lisp_Object regexp, Lisp_Object string, Lisp_Object start,
+               bool posix)
 {
   ptrdiff_t val;
   struct re_pattern_buffer *bufp;
@@ -975,9 +977,9 @@
 
 static Lisp_Object
 search_command (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror,
-               Lisp_Object count, int direction, int RE, int posix)
+               Lisp_Object count, int direction, int RE, bool posix)
 {
-  register EMACS_INT np;
+  EMACS_INT np;
   EMACS_INT lim;
   ptrdiff_t lim_byte;
   EMACS_INT n = direction;
@@ -1047,9 +1049,9 @@
   return make_number (np);
 }
 
-/* Return 1 if REGEXP it matches just one constant string.  */
+/* Return true if REGEXP it matches just one constant string.  */
 
-static int
+static bool
 trivial_regexp_p (Lisp_Object regexp)
 {
   ptrdiff_t len = SBYTES (regexp);
@@ -1118,7 +1120,7 @@
 static EMACS_INT
 search_buffer (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte,
               ptrdiff_t lim, ptrdiff_t lim_byte, EMACS_INT n,
-              int RE, Lisp_Object trt, Lisp_Object inverse_trt, int posix)
+              int RE, Lisp_Object trt, Lisp_Object inverse_trt, bool posix)
 {
   ptrdiff_t len = SCHARS (string);
   ptrdiff_t len_byte = SBYTES (string);
@@ -1273,7 +1275,7 @@
       /* Set to positive if we find a non-ASCII char that need
         translation.  Otherwise set to zero later.  */
       int char_base = -1;
-      int boyer_moore_ok = 1;
+      bool boyer_moore_ok = 1;
 
       /* MULTIBYTE says whether the text to be searched is multibyte.
         We must convert PATTERN to match that, or we will not really
@@ -2282,12 +2284,12 @@
   (Lisp_Object newtext, Lisp_Object fixedcase, Lisp_Object literal, 
Lisp_Object string, Lisp_Object subexp)
 {
   enum { nochange, all_caps, cap_initial } case_action;
-  register ptrdiff_t pos, pos_byte;
-  int some_multiletter_word;
-  int some_lowercase;
-  int some_uppercase;
-  int some_nonuppercase_initial;
-  register int c, prevc;
+  ptrdiff_t pos, pos_byte;
+  bool some_multiletter_word;
+  bool some_lowercase;
+  bool some_uppercase;
+  bool some_nonuppercase_initial;
+  int c, prevc;
   ptrdiff_t sub;
   ptrdiff_t opoint, newpoint;
 
@@ -2432,7 +2434,7 @@
            {
              ptrdiff_t substart = -1;
              ptrdiff_t subend = 0;
-             int delbackslash = 0;
+             bool delbackslash = 0;
 
              FETCH_STRING_CHAR_ADVANCE (c, newtext, pos, pos_byte);
 
@@ -2529,7 +2531,7 @@
       ptrdiff_t substed_alloc_size, substed_len;
       bool buf_multibyte = !NILP (BVAR (current_buffer, 
enable_multibyte_characters));
       bool str_multibyte = STRING_MULTIBYTE (newtext);
-      int really_changed = 0;
+      bool really_changed = 0;
 
       substed_alloc_size = ((STRING_BYTES_BOUND - 100) / 2 < length
                            ? STRING_BYTES_BOUND
@@ -2695,7 +2697,7 @@
 }
 
 static Lisp_Object
-match_limit (Lisp_Object num, int beginningp)
+match_limit (Lisp_Object num, bool beginningp)
 {
   EMACS_INT n;
 
@@ -2968,9 +2970,9 @@
   return Qnil;
 }
 
-/* If non-zero the match data have been saved in saved_search_regs
+/* If true the match data have been saved in saved_search_regs
    during the execution of a sentinel or filter. */
-static int search_regs_saved;
+static bool search_regs_saved;
 static struct re_registers saved_search_regs;
 static Lisp_Object saved_last_thing_searched;
 
@@ -3035,9 +3037,9 @@
        doc: /* Return a regexp string which matches exactly STRING and nothing 
else.  */)
   (Lisp_Object string)
 {
-  register char *in, *out, *end;
-  register char *temp;
-  int backslashes_added = 0;
+  char *in, *out, *end;
+  char *temp;
+  ptrdiff_t backslashes_added = 0;
 
   CHECK_STRING (string);
 


reply via email to

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