emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r109509: Inline functions to examine


From: Dmitry Antipov
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r109509: Inline functions to examine and change string intervals.
Date: Wed, 08 Aug 2012 14:23:04 +0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 109509
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Wed 2012-08-08 14:23:04 +0400
message:
  Inline functions to examine and change string intervals.
  * lisp.h (STRING_INTERVALS, STRING_SET_INTERVALS): Remove.
  (string_get_intervals, string_set_intervals): New function.
  * alloc.c, buffer.c, editfns.c, fns.c, insdel.c, intervals.c:
  * lread.c, print.c, textprop.c: Adjust users.
modified:
  src/ChangeLog
  src/alloc.c
  src/buffer.c
  src/editfns.c
  src/fns.c
  src/insdel.c
  src/intervals.c
  src/lisp.h
  src/lread.c
  src/print.c
  src/textprop.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-08-08 07:19:58 +0000
+++ b/src/ChangeLog     2012-08-08 10:23:04 +0000
@@ -1,3 +1,11 @@
+2012-08-08  Dmitry Antipov  <address@hidden>
+
+       Inline functions to examine and change string intervals.
+       * lisp.h (STRING_INTERVALS, STRING_SET_INTERVALS): Remove.
+       (string_get_intervals, string_set_intervals): New function.
+       * alloc.c, buffer.c, editfns.c, fns.c, insdel.c, intervals.c:
+       * lread.c, print.c, textprop.c: Adjust users.
+
 2012-08-08  Glenn Morris  <address@hidden>
 
        * lisp.mk (lisp): Remove language/persian.elc.

=== modified file 'src/alloc.c'
--- a/src/alloc.c       2012-08-08 06:11:29 +0000
+++ b/src/alloc.c       2012-08-08 10:23:04 +0000
@@ -6102,7 +6102,7 @@
          }
        if (!PURE_POINTER_P (XSTRING (ptr->name)))
          MARK_STRING (XSTRING (ptr->name));
-       MARK_INTERVAL_TREE (STRING_INTERVALS (ptr->name));
+       MARK_INTERVAL_TREE (string_get_intervals (ptr->name));
 
        ptr = ptr->next;
        if (ptr)

=== modified file 'src/buffer.c'
--- a/src/buffer.c      2012-08-08 06:11:29 +0000
+++ b/src/buffer.c      2012-08-08 10:23:04 +0000
@@ -384,7 +384,7 @@
   BVAR (b, zv_marker) = Qnil;
 
   name = Fcopy_sequence (buffer_or_name);
-  STRING_SET_INTERVALS (name, NULL);
+  string_set_intervals (name, NULL);
   BVAR (b, name) = name;
 
   BVAR (b, undo_list) = (SREF (name, 0) != ' ') ? Qnil : Qt;
@@ -589,7 +589,7 @@
   all_buffers = b;
 
   name = Fcopy_sequence (name);
-  STRING_SET_INTERVALS (name, NULL);
+  string_set_intervals (name, NULL);
   BVAR (b, name) = name;
 
   reset_buffer (b);

=== modified file 'src/editfns.c'
--- a/src/editfns.c     2012-08-08 06:11:29 +0000
+++ b/src/editfns.c     2012-08-08 10:23:04 +0000
@@ -3933,7 +3933,7 @@
 
                  /* If this argument has text properties, record where
                     in the result string it appears.  */
-                 if (STRING_INTERVALS (args[n]))
+                 if (string_get_intervals (args[n]))
                    info[n].intervals = arg_intervals = 1;
 
                  continue;
@@ -4277,7 +4277,7 @@
      arguments has text properties, set up text properties of the
      result string.  */
 
-  if (STRING_INTERVALS (args[0]) || arg_intervals)
+  if (string_get_intervals (args[0]) || arg_intervals)
     {
       Lisp_Object len, new_len, props;
       struct gcpro gcpro1;

=== modified file 'src/fns.c'
--- a/src/fns.c 2012-08-08 06:11:29 +0000
+++ b/src/fns.c 2012-08-08 10:23:04 +0000
@@ -628,7 +628,7 @@
          ptrdiff_t thislen_byte = SBYTES (this);
 
          memcpy (SDATA (val) + toindex_byte, SDATA (this), SBYTES (this));
-         if (STRING_INTERVALS (this))
+         if (string_get_intervals (this))
            {
              textprops[num_textprops].argnum = argnum;
              textprops[num_textprops].from = 0;
@@ -640,7 +640,7 @@
       /* Copy a single-byte string to a multibyte string.  */
       else if (STRINGP (this) && STRINGP (val))
        {
-         if (STRING_INTERVALS (this))
+         if (string_get_intervals (this))
            {
              textprops[num_textprops].argnum = argnum;
              textprops[num_textprops].from = 0;
@@ -1060,7 +1060,7 @@
        str_as_multibyte (SDATA (new_string), nbytes,
                          SBYTES (string), NULL);
       string = new_string;
-      STRING_SET_INTERVALS (string, NULL);
+      string_set_intervals (string, NULL);
     }
   return string;
 }

=== modified file 'src/insdel.c'
--- a/src/insdel.c      2012-08-08 06:11:29 +0000
+++ b/src/insdel.c      2012-08-08 10:23:04 +0000
@@ -976,7 +976,7 @@
 
   offset_intervals (current_buffer, PT, nchars);
 
-  intervals = STRING_INTERVALS (string);
+  intervals = string_get_intervals (string);
   /* Get the intervals for the part of the string we are inserting.  */
   if (nbytes < SBYTES (string))
     intervals = copy_intervals (intervals, pos, nchars);
@@ -1413,7 +1413,7 @@
 
   /* Get the intervals for the part of the string we are inserting--
      not including the combined-before bytes.  */
-  intervals = STRING_INTERVALS (new);
+  intervals = string_get_intervals (new);
   /* Insert those intervals.  */
   graft_intervals_into_buffer (intervals, from, inschars,
                               current_buffer, inherit);

=== modified file 'src/intervals.c'
--- a/src/intervals.c   2012-08-08 06:11:29 +0000
+++ b/src/intervals.c   2012-08-08 10:23:04 +0000
@@ -84,7 +84,7 @@
     {
       new->total_length = SCHARS (parent);
       eassert (0 <= TOTAL_LENGTH (new));
-      STRING_SET_INTERVALS (parent, new);
+      string_set_intervals (parent, new);
       new->position = 0;
     }
 
@@ -455,7 +455,7 @@
       if (BUFFERP (parent))
        BUF_INTERVALS (XBUFFER (parent)) = interval;
       else if (STRINGP (parent))
-       STRING_SET_INTERVALS (parent, interval);
+       string_set_intervals (parent, interval);
     }
 
   return interval;
@@ -1206,7 +1206,7 @@
       if (BUFFERP (owner))
        BUF_INTERVALS (XBUFFER (owner)) = parent;
       else if (STRINGP (owner))
-       STRING_SET_INTERVALS (owner, parent);
+       string_set_intervals (owner, parent);
       else
        abort ();
 
@@ -2126,7 +2126,7 @@
   else if (BUFFERP (object))
     i = find_interval (BUF_INTERVALS (XBUFFER (object)), pos);
   else if (STRINGP (object))
-    i = find_interval (STRING_INTERVALS (object), pos);
+    i = find_interval (string_get_intervals (object), pos);
   else
     abort ();
 
@@ -2259,7 +2259,7 @@
     return;
 
   interval_set_object (interval_copy, string);
-  STRING_SET_INTERVALS (string, interval_copy);
+  string_set_intervals (string, interval_copy);
 }
 
 /* Return 1 if strings S1 and S2 have identical properties; 0 otherwise.
@@ -2272,8 +2272,8 @@
   ptrdiff_t pos = 0;
   ptrdiff_t end = SCHARS (s1);
 
-  i1 = find_interval (STRING_INTERVALS (s1), 0);
-  i2 = find_interval (STRING_INTERVALS (s2), 0);
+  i1 = find_interval (string_get_intervals (s1), 0);
+  i2 = find_interval (string_get_intervals (s2), 0);
 
   while (pos < end)
     {

=== modified file 'src/lisp.h'
--- a/src/lisp.h        2012-08-07 13:37:21 +0000
+++ b/src/lisp.h        2012-08-08 10:23:04 +0000
@@ -752,12 +752,6 @@
       (STR) = empty_multibyte_string;  \
     else XSTRING (STR)->size_byte = XSTRING (STR)->size; } while (0)
 
-/* Get text properties.  */
-#define STRING_INTERVALS(STR)  (XSTRING (STR)->intervals + 0)
-
-/* Set text properties.  */
-#define STRING_SET_INTERVALS(STR, INT) (XSTRING (STR)->intervals = (INT))
-
 /* In a string or vector, the sign bit of the `size' is the gc mark bit.  */
 
 struct Lisp_String
@@ -2420,6 +2414,22 @@
   XOVERLAY (overlay)->plist = plist;
 }
 
+/* Get text properties of S.  */
+
+LISP_INLINE INTERVAL
+string_get_intervals (Lisp_Object s)
+{
+  return XSTRING (s)->intervals;
+}
+
+/* Set text properties of S to I.  */
+
+LISP_INLINE void
+string_set_intervals (Lisp_Object s, INTERVAL i)
+{
+  XSTRING (s)->intervals = i;
+}
+
 /* Defined in data.c.  */
 extern Lisp_Object Qnil, Qt, Qquote, Qlambda, Qunbound;
 extern Lisp_Object Qerror_conditions, Qerror_message, Qtop_level;

=== modified file 'src/lread.c'
--- a/src/lread.c       2012-08-07 13:37:21 +0000
+++ b/src/lread.c       2012-08-08 10:23:04 +0000
@@ -3189,7 +3189,7 @@
        /* Check for text properties in each interval.
           substitute_in_interval contains part of the logic.  */
 
-       INTERVAL    root_interval = STRING_INTERVALS (subtree);
+       INTERVAL    root_interval = string_get_intervals (subtree);
        Lisp_Object arg           = Fcons (object, placeholder);
 
        traverse_intervals_noorder (root_interval,

=== modified file 'src/print.c'
--- a/src/print.c       2012-08-08 06:11:29 +0000
+++ b/src/print.c       2012-08-08 10:23:04 +0000
@@ -1194,7 +1194,7 @@
        {
        case Lisp_String:
          /* A string may have text properties, which can be circular.  */
-         traverse_intervals_noorder (STRING_INTERVALS (obj),
+         traverse_intervals_noorder (string_get_intervals (obj),
                                      print_preprocess_string, Qnil);
          break;
 
@@ -1297,7 +1297,7 @@
 print_prune_string_charset (Lisp_Object string)
 {
   print_check_string_result = 0;
-  traverse_intervals (STRING_INTERVALS (string), 0,
+  traverse_intervals (string_get_intervals (string), 0,
                      print_check_string_charset_prop, string);
   if (! (print_check_string_result & PRINT_STRING_UNSAFE_CHARSET_FOUND))
     {
@@ -1408,7 +1408,7 @@
          if (! EQ (Vprint_charset_text_property, Qt))
            obj = print_prune_string_charset (obj);
 
-         if (STRING_INTERVALS (obj))
+         if (string_get_intervals (obj))
            {
              PRINTCHAR ('#');
              PRINTCHAR ('(');
@@ -1499,9 +1499,9 @@
            }
          PRINTCHAR ('\"');
 
-         if (STRING_INTERVALS (obj))
+         if (string_get_intervals (obj))
            {
-             traverse_intervals (STRING_INTERVALS (obj),
+             traverse_intervals (string_get_intervals (obj),
                                  0, print_interval, printcharfun);
              PRINTCHAR (')');
            }

=== modified file 'src/textprop.c'
--- a/src/textprop.c    2012-08-08 06:11:29 +0000
+++ b/src/textprop.c    2012-08-08 10:23:04 +0000
@@ -161,7 +161,7 @@
       XSETFASTINT (*begin, XFASTINT (*begin));
       if (begin != end)
        XSETFASTINT (*end, XFASTINT (*end));
-      i = STRING_INTERVALS (object);
+      i = string_get_intervals (object);
 
       if (len == 0)
        return NULL;
@@ -516,7 +516,7 @@
     {
       beg = 0;
       end = SCHARS (object);
-      i = STRING_INTERVALS (object);
+      i = string_get_intervals (object);
     }
 
   if (!(beg <= position && position <= end))
@@ -1274,10 +1274,10 @@
       && XFASTINT (start) == 0
       && XFASTINT (end) == SCHARS (object))
     {
-      if (! STRING_INTERVALS (object))
+      if (!string_get_intervals (object))
        return Qnil;
 
-      STRING_SET_INTERVALS (object, NULL);
+      string_set_intervals (object, NULL);
       return Qt;
     }
 


reply via email to

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