Use STRING_BYTES and SET_STRING_BYTES.
authorRichard M. Stallman <rms@gnu.org>
Sat, 21 Mar 1998 07:06:14 +0000 (07:06 +0000)
committerRichard M. Stallman <rms@gnu.org>
Sat, 21 Mar 1998 07:06:14 +0000 (07:06 +0000)
31 files changed:
src/abbrev.c
src/alloc.c
src/buffer.c
src/bytecode.c
src/callint.c
src/callproc.c
src/casefiddle.c
src/category.c
src/ccl.c
src/charset.c
src/coding.c
src/data.c
src/dispnew.c
src/doc.c
src/fileio.c
src/filelock.c
src/fns.c
src/frame.c
src/insdel.c
src/keyboard.c
src/keymap.c
src/lread.c
src/minibuf.c
src/print.c
src/process.c
src/search.c
src/xdisp.c
src/xfns.c
src/xmenu.c
src/xselect.c
src/xterm.c

index ebe89e8..f681ed9 100644 (file)
@@ -324,7 +324,7 @@ Returns the abbrev symbol, if expansion took place.")
       del_range_both (wordstart, wordstart_byte, wordend, wordend_byte, 1);
 
       insert_from_string (expansion, 0, 0, XSTRING (expansion)->size,
-                         XSTRING (expansion)->size_byte, 1);
+                         STRING_BYTES (XSTRING (expansion)), 1);
       SET_PT (PT + whitecnt);
 
       if (uccount && !lccount)
@@ -390,11 +390,11 @@ is not undone.")
       if (!STRINGP (val))
        error ("value of abbrev-symbol must be a string");
       zv_before = ZV;
-      del_range_byte (PT_BYTE, PT_BYTE + XSTRING (val)->size_byte, 1);
+      del_range_byte (PT_BYTE, PT_BYTE + STRING_BYTES (XSTRING (val)), 1);
       /* Don't inherit properties here; just copy from old contents.  */
       insert_from_string (Vlast_abbrev_text, 0, 0,
                          XSTRING (Vlast_abbrev_text)->size,
-                         XSTRING (Vlast_abbrev_text)->size_byte, 0);
+                         STRING_BYTES (XSTRING (Vlast_abbrev_text)), 0);
       Vlast_abbrev_text = Qnil;
       /* Total number of characters deleted.  */
       adjust = ZV - zv_before;
index 337a7f0..5948229 100644 (file)
@@ -1376,7 +1376,7 @@ make_uninit_multibyte_string (length, length_byte)
     
   string_chars_consed += fullsize;
   XSTRING (val)->size = length;
-  XSTRING (val)->size_byte = length_byte;
+  SET_STRING_BYTES (XSTRING (val), length_byte);
   XSTRING (val)->data[length_byte] = 0;
   INITIALIZE_INTERVAL (XSTRING (val), NULL_INTERVAL);
 
@@ -1442,7 +1442,7 @@ make_pure_string (data, length, length_byte)
     error ("Pure Lisp storage exhausted");
   XSETSTRING (new, PUREBEG + pureptr);
   XSTRING (new)->size = length;
-  XSTRING (new)->size_byte = length_byte;
+  SET_STRING_BYTES (XSTRING (new), length_byte);
   bcopy (data, XSTRING (new)->data, length_byte);
   XSTRING (new)->data[length_byte] = 0;
 
@@ -1548,7 +1548,7 @@ Does not copy symbols.")
 #endif /* LISP_FLOAT_TYPE */
   else if (STRINGP (obj))
     return make_pure_string (XSTRING (obj)->data, XSTRING (obj)->size,
-                            XSTRING (obj)->size_byte);
+                            STRING_BYTES (XSTRING (obj)));
   else if (COMPILEDP (obj) || VECTORP (obj))
     {
       register struct Lisp_Vector *vec;
@@ -2646,7 +2646,7 @@ compact_strings ()
 
          register struct Lisp_String *newaddr;
          register EMACS_INT size = nextstr->size;
-         EMACS_INT size_byte = nextstr->size_byte;
+         EMACS_INT size_byte = STRING_BYTES (nextstr);
 
          /* NEXTSTR is the old address of the next string.
             Just skip it if it isn't marked.  */
index 8663ff3..69010af 100644 (file)
@@ -2364,9 +2364,9 @@ record_overlay_string (ssl, str, str2, pri, size)
     nbytes = XSTRING (str)->size;
   else if (! STRING_MULTIBYTE (str))
     nbytes = count_size_as_multibyte (XSTRING (str)->data,
-                                     XSTRING (str)->size_byte);
+                                     STRING_BYTES (XSTRING (str)));
   else
-    nbytes = XSTRING (str)->size_byte;
+    nbytes = STRING_BYTES (XSTRING (str));
 
   ssl->bytes += nbytes;
 
@@ -2376,9 +2376,9 @@ record_overlay_string (ssl, str, str2, pri, size)
        nbytes = XSTRING (str2)->size;
       else if (! STRING_MULTIBYTE (str2))
        nbytes = count_size_as_multibyte (XSTRING (str2)->data,
-                                         XSTRING (str2)->size_byte);
+                                         STRING_BYTES (XSTRING (str2)));
       else
-       nbytes = XSTRING (str2)->size_byte;
+       nbytes = STRING_BYTES (XSTRING (str2));
 
       ssl->bytes += nbytes;
     }
@@ -2490,7 +2490,8 @@ overlay_strings (pos, w, pstr)
        {
          int nbytes;
          tem = overlay_tails.buf[i].string;
-         nbytes = copy_text (XSTRING (tem)->data, p, XSTRING (tem)->size_byte,
+         nbytes = copy_text (XSTRING (tem)->data, p,
+                             STRING_BYTES (XSTRING (tem)),
                              STRING_MULTIBYTE (tem), multibyte);
          p += nbytes;
        }
@@ -2498,14 +2499,15 @@ overlay_strings (pos, w, pstr)
        {
          int nbytes;
          tem = overlay_heads.buf[i].string;
-         nbytes = copy_text (XSTRING (tem)->data, p, XSTRING (tem)->size_byte,
+         nbytes = copy_text (XSTRING (tem)->data, p,
+                             STRING_BYTES (XSTRING (tem)),
                              STRING_MULTIBYTE (tem), multibyte);
          p += nbytes;
          tem = overlay_heads.buf[i].string2;
          if (STRINGP (tem))
            {
              nbytes = copy_text (XSTRING (tem)->data, p,
-                                 XSTRING (tem)->size_byte,
+                                 STRING_BYTES (XSTRING (tem)),
                                  STRING_MULTIBYTE (tem), multibyte);
              p += nbytes;
            }
index 193630f..60e34a4 100644 (file)
@@ -306,7 +306,7 @@ If the third argument is incorrect, Emacs may crash.")
   /* Cached address of beginning of string,
      valid if BYTESTR equals STRING_SAVED.  */
   register unsigned char *strbeg;
-  int bytestr_length = XSTRING (bytestr)->size_byte;
+  int bytestr_length = STRING_BYTES (XSTRING (bytestr));
 
   CHECK_STRING (bytestr, 0);
   if (!VECTORP (vector))
index 0fb5e94..fd4ea1a 100644 (file)
@@ -288,8 +288,9 @@ Otherwise, this is done only if an arg is read using the minibuffer.")
     {
       /* Make a copy of string so that if a GC relocates specs,
         `string' will still be valid.  */
-      string = (unsigned char *) alloca (XSTRING (specs)->size_byte + 1);
-      bcopy (XSTRING (specs)->data, string, XSTRING (specs)->size_byte + 1);
+      string = (unsigned char *) alloca (STRING_BYTES (XSTRING (specs)) + 1);
+      bcopy (XSTRING (specs)->data, string,
+            STRING_BYTES (XSTRING (specs)) + 1);
     }
   else if (string == 0)
     {
index 17c0ee9..2bb18b3 100644 (file)
@@ -445,7 +445,7 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.")
          for (i = 4; i < nargs; i++)
            {
              int size = encoding_buffer_size (&argument_coding,
-                                              XSTRING (args[i])->size_byte);
+                                              STRING_BYTES (XSTRING (args[i])));
              unsigned char *dummy1 = (unsigned char *) alloca (size);
              int dummy;
 
@@ -454,7 +454,7 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.")
              encode_coding (&argument_coding,
                             XSTRING (args[i])->data,
                             new_argv[i - 3],
-                            XSTRING (args[i])->size_byte,
+                            STRING_BYTES (XSTRING (args[i])),
                             size);
              new_argv[i - 3][argument_coding.produced] = 0;
            }
@@ -837,9 +837,9 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.")
   strcat (tempfile, "detmp.XXX");
 #endif
 #else /* not DOS_NT */
-  char *tempfile = (char *) alloca (XSTRING (Vtemp_file_name_pattern)->size_byte + 1);
+  char *tempfile = (char *) alloca (STRING_BYTES (XSTRING (Vtemp_file_name_pattern)) + 1);
   bcopy (XSTRING (Vtemp_file_name_pattern)->data, tempfile,
-        XSTRING (Vtemp_file_name_pattern)->size_byte + 1);
+        STRING_BYTES (XSTRING (Vtemp_file_name_pattern)) + 1);
 #endif /* not DOS_NT */
 
   mktemp (tempfile);
@@ -977,7 +977,7 @@ child_setup (in, out, err, new_argv, set_pgrp, current_dir)
     register char *temp;
     register int i;
 
-    i = XSTRING (current_dir)->size_byte;
+    i = STRING_BYTES (XSTRING (current_dir));
     pwd_var = (char *) alloca (i + 6);
     temp = pwd_var + 4;
     bcopy ("PWD=", pwd_var, 4);
@@ -1172,7 +1172,7 @@ getenv_internal (var, varlen, value, valuelen)
 
       entry = XCONS (scan)->car;
       if (STRINGP (entry)
-         && XSTRING (entry)->size_byte > varlen
+         && STRING_BYTES (XSTRING (entry)) > varlen
          && XSTRING (entry)->data[varlen] == '='
 #ifdef WINDOWSNT
          /* NT environment variables are case insensitive.  */
@@ -1183,7 +1183,7 @@ getenv_internal (var, varlen, value, valuelen)
          )
        {
          *value    = (char *) XSTRING (entry)->data + (varlen + 1);
-         *valuelen = XSTRING (entry)->size_byte - (varlen + 1);
+         *valuelen = STRING_BYTES (XSTRING (entry)) - (varlen + 1);
          return 1;
        }
     }
@@ -1202,7 +1202,7 @@ This function consults the variable ``process-environment'' for its value.")
   int valuelen;
 
   CHECK_STRING (var, 0);
-  if (getenv_internal (XSTRING (var)->data, XSTRING (var)->size_byte,
+  if (getenv_internal (XSTRING (var)->data, STRING_BYTES (XSTRING (var)),
                       &value, &valuelen))
     return make_string (value, valuelen);
   else
index aa9d36b..d3ddf6c 100644 (file)
@@ -63,7 +63,7 @@ casify_object (flag, obj)
          int multibyte = STRING_MULTIBYTE (obj);
 
          obj = Fcopy_sequence (obj);
-         len = XSTRING (obj)->size_byte;
+         len = STRING_BYTES (XSTRING (obj));
 
          /* Scan all single-byte characters from start of string.  */
          for (i = 0; i < len;)
index 85fbaa3..d1d2f57 100644 (file)
@@ -492,7 +492,7 @@ describe_category (value)
 
   mnemonics = Fcategory_set_mnemonics (value);
   insert_from_string (mnemonics, 0, 0, XSTRING (mnemonics)->size,
-                     XSTRING (mnemonics)->size_byte, 0);
+                     STRING_BYTES (XSTRING (mnemonics)), 0);
   insert_string ("\n");
   return;
 }
@@ -526,7 +526,7 @@ describe_category_1 (vector)
        insert_char (i + 32);
        insert (": ", 2);
        insert_from_string (elt, 0, 0, XSTRING (elt)->size,
-                           XSTRING (elt)->size_byte, 0);
+                           STRING_BYTES (XSTRING (elt)), 0);
        insert ("\n", 1);
       }
   }
index a41706d..8e8575a 100644 (file)
--- a/src/ccl.c
+++ b/src/ccl.c
@@ -1568,13 +1568,13 @@ is a unibyte string.  By default it is a multibyte string.")
       if (ccl.ic < i && i < ccl.size)
        ccl.ic = i;
     }
-  outbufsize = XSTRING (str)->size_byte * ccl.buf_magnification + 256;
+  outbufsize = STRING_BYTES (XSTRING (str)) * ccl.buf_magnification + 256;
   outbuf = (char *) xmalloc (outbufsize);
   if (!outbuf)
     error ("Not enough memory");
   ccl.last_block = NILP (contin);
   produced = ccl_driver (&ccl, XSTRING (str)->data, outbuf,
-                        XSTRING (str)->size_byte, outbufsize, (int *)0);
+                        STRING_BYTES (XSTRING (str)), outbufsize, (int *)0);
   for (i = 0; i < 8; i++)
     XSET (XVECTOR (status)->contents[i], Lisp_Int, ccl.reg[i]);
   XSETINT (XVECTOR (status)->contents[8], ccl.ic);
index 7e9d1ea..af8a249 100644 (file)
@@ -747,7 +747,7 @@ Optional arg TABLE if non-nil is a unification table to look up.")
     return Qnil;
 
   bzero (charsets, (MAX_CHARSET + 1) * sizeof (int));
-  find_charset_in_str (XSTRING (str)->data, XSTRING (str)->size_byte,
+  find_charset_in_str (XSTRING (str)->data, STRING_BYTES (XSTRING (str)),
                       charsets, table);
   val = Qnil;
   for (i = MAX_CHARSET; i >= 0; i--)
@@ -1029,7 +1029,8 @@ the following bytes is not checked.")
   Lisp_Object val;
 
   CHECK_STRING (str, 0);
-  XSETFASTINT (val, strwidth (XSTRING (str)->data, XSTRING (str)->size_byte));
+  XSETFASTINT (val, strwidth (XSTRING (str)->data,
+                             STRING_BYTES (XSTRING (str))));
   return val;
 }
 
@@ -1519,7 +1520,7 @@ DEFUN ("compose-string", Fcompose_string, Scompose_string,
 
   buf[0] = LEADING_CODE_COMPOSITION;
   p = XSTRING (str)->data;
-  pend = p + XSTRING (str)->size_byte;
+  pend = p + STRING_BYTES (XSTRING (str));
   i = 1;
   while (p < pend)
     {
index 0f6fc3d..5e4c0b9 100644 (file)
@@ -4283,7 +4283,8 @@ code_convert_string (str, coding, encodep, nocopy)
 {
   int len;
   char *buf;
-  int from = 0, to = XSTRING (str)->size, to_byte = XSTRING (str)->size_byte;
+  int from = 0, to = XSTRING (str)->size;
+  int to_byte = STRING_BYTES (XSTRING (str));
   struct gcpro gcpro1;
   Lisp_Object saved_coding_symbol = Qnil;
   int result;
@@ -4359,7 +4360,7 @@ code_convert_string (str, coding, encodep, nocopy)
     len = encoding_buffer_size (coding, to_byte - from);
   else
     len = decoding_buffer_size (coding, to_byte - from);
-  len += from + XSTRING (str)->size_byte - to_byte;
+  len += from + STRING_BYTES (XSTRING (str)) - to_byte;
   GCPRO1 (str);
   buf = get_conversion_buffer (len);
   UNGCPRO;
@@ -4381,9 +4382,9 @@ code_convert_string (str, coding, encodep, nocopy)
     }
 
   bcopy (XSTRING (str)->data + to_byte, buf + from + coding->produced,
-        XSTRING (str)->size_byte - to_byte);
+        STRING_BYTES (XSTRING (str)) - to_byte);
 
-  len = from + XSTRING (str)->size_byte - to_byte;
+  len = from + STRING_BYTES (XSTRING (str)) - to_byte;
   if (encodep)
     str = make_unibyte_string (buf, len + coding->produced);
   else
@@ -4565,7 +4566,7 @@ highest priority.")
   CHECK_STRING (string, 0);
 
   return detect_coding_system (XSTRING (string)->data,
-                              XSTRING (string)->size_byte,
+                              STRING_BYTES (XSTRING (string)),
                               !NILP (highest));
 }
 
index bf63758..300782a 100644 (file)
@@ -1648,7 +1648,7 @@ or a byte-code object.  IDX starts at 0.")
       idxval_byte = string_char_to_byte (array, idxval);
 
       c = STRING_CHAR (&XSTRING (array)->data[idxval_byte],
-                      XSTRING (array)->size_byte - idxval_byte);
+                      STRING_BYTES (XSTRING (array)) - idxval_byte);
       return make_number (c);
     }
   else if (BOOL_VECTOR_P (array))
@@ -1847,7 +1847,7 @@ IDX starts at 0.")
       p = &XSTRING (array)->data[idxval_byte];
 
       actual_len
-       = MULTIBYTE_FORM_LENGTH (p, XSTRING (array)->size_byte - idxval_byte);
+       = MULTIBYTE_FORM_LENGTH (p, STRING_BYTES (XSTRING (array)) - idxval_byte);
       new_len = Fchar_bytes (newelt);
       if (actual_len != XINT (new_len))
        error ("Attempt to change byte length of a string");
index f859504..5bb9715 100644 (file)
@@ -2251,11 +2251,12 @@ Control characters in STRING will have terminal-dependent effects.")
 {
   /* ??? Perhaps we should do something special for multibyte strings here.  */
   CHECK_STRING (string, 0);
-  fwrite (XSTRING (string)->data, 1, XSTRING (string)->size_byte, stdout);
+  fwrite (XSTRING (string)->data, 1, STRING_BYTES (XSTRING (string)), stdout);
   fflush (stdout);
   if (termscript)
     {
-      fwrite (XSTRING (string)->data, 1, XSTRING (string)->size_byte, termscript);
+      fwrite (XSTRING (string)->data, 1, STRING_BYTES (XSTRING (string)),
+             termscript);
       fflush (termscript);
     }
   return Qnil;
index adc4529..1923c86 100644 (file)
--- a/src/doc.c
+++ b/src/doc.c
@@ -562,11 +562,11 @@ thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ int
   if (NILP (keymap))
     keymap = Voverriding_local_map;
 
-  bsize = XSTRING (string)->size_byte;
+  bsize = STRING_BYTES (XSTRING (string));
   bufp = buf = (unsigned char *) xmalloc (bsize);
 
   strp = (unsigned char *) XSTRING (string)->data;
-  while (strp < XSTRING (string)->data + XSTRING (string)->size_byte)
+  while (strp < XSTRING (string)->data + STRING_BYTES (XSTRING (string)))
     {
       if (strp[0] == '\\' && strp[1] == '=')
        {
@@ -577,7 +577,7 @@ thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ int
          if (multibyte)
            {
              int len;
-             int maxlen = XSTRING (string)->data + XSTRING (string)->size_byte - strp;
+             int maxlen = XSTRING (string)->data + STRING_BYTES (XSTRING (string)) - strp;
 
              STRING_CHAR_AND_LENGTH (strp, maxlen, len);
              if (len == 1)
@@ -600,7 +600,7 @@ thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ int
          start = strp;
 
          while ((strp - (unsigned char *) XSTRING (string)->data
-                 < XSTRING (string)->size_byte)
+                 < STRING_BYTES (XSTRING (string)))
                 && *strp != ']')
            strp++;
          length_byte = strp - start;
@@ -685,7 +685,7 @@ thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ int
              insert_string ("\nUses keymap \"");
              insert_from_string (name, 0, 0,
                                  XSTRING (name)->size,
-                                 XSTRING (name)->size_byte, 1);
+                                 STRING_BYTES (XSTRING (name)), 1);
              insert_string ("\", which is not currently defined.\n");
              if (start[-1] == '<') keymap = Qnil;
            }
@@ -700,7 +700,7 @@ thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ int
        subst_string:
          start = XSTRING (tem)->data;
          length = XSTRING (tem)->size;
-         length_byte = XSTRING (tem)->size_byte;
+         length_byte = STRING_BYTES (XSTRING (tem));
        subst:
          new = (unsigned char *) xrealloc (buf, bsize += length_byte);
          bufp += new - buf;
@@ -716,7 +716,7 @@ thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ int
       else
        {
          int len;
-         int maxlen = XSTRING (string)->data + XSTRING (string)->size_byte - strp;
+         int maxlen = XSTRING (string)->data + STRING_BYTES (XSTRING (string)) - strp;
 
          STRING_CHAR_AND_LENGTH (strp, maxlen, len);
          if (len == 1)
index 59d587a..24bf244 100644 (file)
@@ -375,7 +375,7 @@ on VMS, perhaps instead a string ending in `:', `]' or `>'.")
 #ifdef DOS_NT
   beg = strcpy (alloca (strlen (beg) + 1), beg);
 #endif
-  p = beg + XSTRING (filename)->size_byte;
+  p = beg + STRING_BYTES (XSTRING (filename));
 
   while (p != beg && !IS_DIRECTORY_SEP (p[-1])
 #ifdef VMS
@@ -432,7 +432,7 @@ or the entire name if it contains no slash.")
     return call2 (handler, Qfile_name_nondirectory, filename);
 
   beg = XSTRING (filename)->data;
-  end = p = beg + XSTRING (filename)->size_byte;
+  end = p = beg + STRING_BYTES (XSTRING (filename));
 
   while (p != beg && !IS_DIRECTORY_SEP (p[-1])
 #ifdef VMS
@@ -585,7 +585,7 @@ On VMS, converts \"[X]FOO.DIR\" to \"[X.FOO]\", etc.")
   if (!NILP (handler))
     return call2 (handler, Qfile_name_as_directory, file);
 
-  buf = (char *) alloca (XSTRING (file)->size_byte + 10);
+  buf = (char *) alloca (STRING_BYTES (XSTRING (file)) + 10);
   return build_string (file_name_as_directory (buf, XSTRING (file)->data));
 }
 \f
@@ -780,9 +780,9 @@ it returns a file name such as \"[X]Y.DIR.1\".")
   /* 20 extra chars is insufficient for VMS, since we might perform a
      logical name translation. an equivalence string can be up to 255
      chars long, so grab that much extra space...  - sss */
-  buf = (char *) alloca (XSTRING (directory)->size_byte + 20 + 255);
+  buf = (char *) alloca (STRING_BYTES (XSTRING (directory)) + 20 + 255);
 #else
-  buf = (char *) alloca (XSTRING (directory)->size_byte + 20);
+  buf = (char *) alloca (STRING_BYTES (XSTRING (directory)) + 20);
 #endif
   directory_file_name (XSTRING (directory)->data, buf);
   return build_string (buf);
@@ -1805,7 +1805,7 @@ duplicates what `expand-file-name' does.")
   CORRECT_DIR_SEPS (nm);
   substituted = (strcmp (nm, XSTRING (filename)->data) != 0);
 #endif
-  endp = nm + XSTRING (filename)->size_byte;
+  endp = nm + STRING_BYTES (XSTRING (filename));
 
   /* If /~ or // appears, discard everything through first slash.  */
 
@@ -1898,7 +1898,7 @@ duplicates what `expand-file-name' does.")
 
   /* If substitution required, recopy the string and do it */
   /* Make space in stack frame for the new copy */
-  xnm = (unsigned char *) alloca (XSTRING (filename)->size_byte + total + 1);
+  xnm = (unsigned char *) alloca (STRING_BYTES (XSTRING (filename)) + total + 1);
   x = xnm;
 
   /* Copy the rest of the name through, replacing $ constructs with values */
@@ -2017,7 +2017,7 @@ expand_and_dir_to_file (filename, defdir)
   absname = Fexpand_file_name (filename, defdir);
 #ifdef VMS
   {
-    register int c = XSTRING (absname)->data[XSTRING (absname)->size_byte - 1];
+    register int c = XSTRING (absname)->data[STRING_BYTES (XSTRING (absname)) - 1];
     if (c == ':' || c == ']' || c == '>')
       absname = Fdirectory_file_name (absname);
   }
@@ -2025,8 +2025,8 @@ expand_and_dir_to_file (filename, defdir)
   /* Remove final slash, if any (unless this is the root dir).
      stat behaves differently depending!  */
   if (XSTRING (absname)->size > 1
-      && IS_DIRECTORY_SEP (XSTRING (absname)->data[XSTRING (absname)->size_byte - 1])
-      && !IS_DEVICE_SEP (XSTRING (absname)->data[XSTRING (absname)->size_byte-2]))
+      && IS_DIRECTORY_SEP (XSTRING (absname)->data[STRING_BYTES (XSTRING (absname)) - 1])
+      && !IS_DEVICE_SEP (XSTRING (absname)->data[STRING_BYTES (XSTRING (absname))-2]))
     /* We cannot take shortcuts; they might be wrong for magic file names.  */
     absname = Fdirectory_file_name (absname);
 #endif
@@ -4240,7 +4240,7 @@ to the file, instead of any buffer contents, and END is ignored.")
   if (STRINGP (start))
     {
       failure = 0 > a_write (desc, XSTRING (start)->data,
-                            XSTRING (start)->size_byte, 0, &annotations,
+                            STRING_BYTES (XSTRING (start)), 0, &annotations,
                             &coding);
       save_errno = errno;
     }
@@ -4510,7 +4510,7 @@ a_write (desc, addr, nbytes, bytepos, annot, coding)
       tem = Fcdr (Fcar (*annot));
       if (STRINGP (tem))
        {
-         if (0 > e_write (desc, XSTRING (tem)->data, XSTRING (tem)->size_byte,
+         if (0 > e_write (desc, XSTRING (tem)->data, STRING_BYTES (XSTRING (tem)),
                           coding))
            return -1;
        }
@@ -4793,11 +4793,11 @@ A non-nil CURRENT-ONLY argument means save only current buffer.")
            if (!NILP (b->filename))
              {
                fwrite (XSTRING (b->filename)->data, 1,
-                       XSTRING (b->filename)->size_byte, stream);
+                       STRING_BYTES (XSTRING (b->filename)), stream);
              }
            putc ('\n', stream);
            fwrite (XSTRING (b->auto_save_file_name)->data, 1,
-                   XSTRING (b->auto_save_file_name)->size_byte, stream);
+                   STRING_BYTES (XSTRING (b->auto_save_file_name)), stream);
            putc ('\n', stream);
          }
 
@@ -4931,7 +4931,7 @@ double_dollars (val)
   register int n;
   int osize, count;
 
-  osize = XSTRING (val)->size_byte;
+  osize = STRING_BYTES (XSTRING (val));
 
   /* Count the number of $ characters.  */
   for (n = osize, count = 0, old = XSTRING (val)->data; n > 0; n--)
@@ -5072,7 +5072,7 @@ DIR defaults to current buffer's directory default.")
       && IS_DIRECTORY_SEP (XSTRING (dir)->data[strlen (homedir)]))
     {
       dir = make_string (XSTRING (dir)->data + strlen (homedir) - 1,
-                        XSTRING (dir)->size_byte - strlen (homedir) + 1);
+                        STRING_BYTES (XSTRING (dir)) - strlen (homedir) + 1);
       XSTRING (dir)->data[0] = '~';
     }
 
index 116f96e..b17fab1 100644 (file)
@@ -129,7 +129,7 @@ typedef struct
 /* Write the name of the lock file for FN into LFNAME.  Length will be
    that of FN plus two more for the leading `.#' plus one for the null.  */
 #define MAKE_LOCK_NAME(lock, file) \
-  (lock = (char *) alloca (XSTRING (file)->size_byte + 2 + 1), \
+  (lock = (char *) alloca (STRING_BYTES (XSTRING (file)) + 2 + 1), \
    fill_in_lock_file_name (lock, (file)))
 
 static void
index 34015c5..6f6694c 100644 (file)
--- a/src/fns.c
+++ b/src/fns.c
@@ -186,7 +186,7 @@ If STRING is a multibyte string, this is greater than the length of STRING.")
      Lisp_Object string;
 {
   CHECK_STRING (string, 1);
-  return make_number (XSTRING (string)->size_byte);
+  return make_number (STRING_BYTES (XSTRING (string)));
 }
 
 DEFUN ("string-equal", Fstring_equal, Sstring_equal, 2, 2, 0,
@@ -204,8 +204,8 @@ Symbols are also allowed; their print names are used instead.")
   CHECK_STRING (s2, 1);
 
   if (XSTRING (s1)->size != XSTRING (s2)->size
-      || XSTRING (s1)->size_byte != XSTRING (s2)->size_byte
-      || bcmp (XSTRING (s1)->data, XSTRING (s2)->data, XSTRING (s1)->size_byte))
+      || STRING_BYTES (XSTRING (s1)) != STRING_BYTES (XSTRING (s2))
+      || bcmp (XSTRING (s1)->data, XSTRING (s2)->data, STRING_BYTES (XSTRING (s1))))
     return Qnil;
   return Qt;
 }
@@ -488,7 +488,7 @@ concat (nargs, args, target_type, last_special)
              if (STRING_MULTIBYTE (this))
                {
                  some_multibyte = 1;
-                 result_len_byte += XSTRING (this)->size_byte;
+                 result_len_byte += STRING_BYTES (XSTRING (this));
                }
              else
                result_len_byte += count_size_as_multibyte (XSTRING (this)->data,
@@ -542,9 +542,9 @@ concat (nargs, args, target_type, last_special)
       if (STRINGP (this) && STRINGP (val)
          && STRING_MULTIBYTE (this) == some_multibyte)
        {
-         int thislen_byte = XSTRING (this)->size_byte;
+         int thislen_byte = STRING_BYTES (XSTRING (this));
          bcopy (XSTRING (this)->data, XSTRING (val)->data + toindex_byte,
-                XSTRING (this)->size_byte);
+                STRING_BYTES (XSTRING (this)));
          toindex_byte += thislen_byte;
          toindex += thisleni;
        }
@@ -664,7 +664,7 @@ string_char_to_byte (string, char_index)
 
   best_below = best_below_byte = 0;
   best_above = XSTRING (string)->size;
-  best_above_byte = XSTRING (string)->size_byte;
+  best_above_byte = STRING_BYTES (XSTRING (string));
 
   if (EQ (string, string_char_byte_cache_string))
     {
@@ -730,7 +730,7 @@ string_byte_to_char (string, byte_index)
 
   best_below = best_below_byte = 0;
   best_above = XSTRING (string)->size;
-  best_above_byte = XSTRING (string)->size_byte;
+  best_above_byte = STRING_BYTES (XSTRING (string));
 
   if (EQ (string, string_char_byte_cache_string))
     {
@@ -798,11 +798,11 @@ string_make_multibyte (string)
                                    XSTRING (string)->size);
   /* If all the chars are ASCII, they won't need any more bytes
      once converted.  In that case, we can return STRING itself.  */
-  if (nbytes == XSTRING (string)->size_byte)
+  if (nbytes == STRING_BYTES (XSTRING (string)))
     return string;
 
   buf = (unsigned char *) alloca (nbytes);
-  copy_text (XSTRING (string)->data, buf, XSTRING (string)->size_byte,
+  copy_text (XSTRING (string)->data, buf, STRING_BYTES (XSTRING (string)),
             0, 1);
 
   return make_multibyte_string (buf, XSTRING (string)->size, nbytes);
@@ -821,7 +821,7 @@ string_make_unibyte (string)
 
   buf = (unsigned char *) alloca (XSTRING (string)->size);
 
-  copy_text (XSTRING (string)->data, buf, XSTRING (string)->size_byte,
+  copy_text (XSTRING (string)->data, buf, STRING_BYTES (XSTRING (string)),
             1, 0);
 
   return make_unibyte_string (buf, XSTRING (string)->size);
@@ -855,7 +855,7 @@ If STRING is unibyte, the result is STRING itself.")
   if (STRING_MULTIBYTE (string))
     {
       string = Fcopy_sequence (string);
-      XSTRING (string)->size = XSTRING (string)->size_byte;
+      XSTRING (string)->size = STRING_BYTES (XSTRING (string));
     }
   return string;
 }
@@ -870,9 +870,9 @@ If STRING is multibyte, the result is STRING itself.")
   if (! STRING_MULTIBYTE (string))
     {
       int newlen = multibyte_chars_in_text (XSTRING (string)->data,
-                                           XSTRING (string)->size_byte);
+                                           STRING_BYTES (XSTRING (string)));
       /* If all the chars are ASCII, STRING is already suitable.  */
-      if (newlen != XSTRING (string)->size_byte)
+      if (newlen != STRING_BYTES (XSTRING (string)))
        {
          string = Fcopy_sequence (string);
          XSTRING (string)->size = newlen;
@@ -932,7 +932,7 @@ This function allows vectors as well as strings.")
   if (STRINGP (string))
     {
       size = XSTRING (string)->size;
-      size_byte = XSTRING (string)->size_byte;
+      size_byte = STRING_BYTES (XSTRING (string));
     }
   else
     size = XVECTOR (string)->size;
@@ -996,7 +996,7 @@ substring_both (string, from, from_byte, to, to_byte)
   if (STRINGP (string))
     {
       size = XSTRING (string)->size;
-      size_byte = XSTRING (string)->size_byte;
+      size_byte = STRING_BYTES (XSTRING (string));
     }
   else
     size = XVECTOR (string)->size;
@@ -1587,10 +1587,10 @@ internal_equal (o1, o2, depth)
     case Lisp_String:
       if (XSTRING (o1)->size != XSTRING (o2)->size)
        return 0;
-      if (XSTRING (o1)->size_byte != XSTRING (o2)->size_byte)
+      if (STRING_BYTES (XSTRING (o1)) != STRING_BYTES (XSTRING (o2)))
        return 0;
       if (bcmp (XSTRING (o1)->data, XSTRING (o2)->data,
-               XSTRING (o1)->size_byte))
+               STRING_BYTES (XSTRING (o1))))
        return 0;
       return 1;
     }
@@ -2075,7 +2075,7 @@ mapcar1 (leni, vals, fn, seq)
   else if (STRINGP (seq))
     {
       /* Multi-byte string.  */
-      int len_byte = XSTRING (seq)->size_byte;
+      int len_byte = STRING_BYTES (XSTRING (seq));
       int i_byte;
 
       for (i = 0, i_byte = 0; i < leni;)
index 63f4e9f..e66cabd 100644 (file)
@@ -1794,7 +1794,7 @@ set_term_frame_name (f, name)
       /* Check for no change needed in this very common case
         before we do any consing.  */
       if (frame_name_fnn_p (XSTRING (f->name)->data,
-                           XSTRING (f->name)->size_byte))
+                           STRING_BYTES (XSTRING (f->name))))
        return;
 
       terminal_frame_count++;
@@ -1811,7 +1811,7 @@ set_term_frame_name (f, name)
 
       /* Don't allow the user to set the frame name to F<num>, so it
         doesn't clash with the names we generate for terminal frames.  */
-      if (frame_name_fnn_p (XSTRING (name)->data, XSTRING (name)->size_byte))
+      if (frame_name_fnn_p (XSTRING (name)->data, STRING_BYTES (XSTRING (name))))
        error ("Frame names of the form F<num> are usurped by Emacs");
     }
 
index e2223f1..55f8b61 100644 (file)
@@ -1189,7 +1189,7 @@ insert_from_string_1 (string, pos, pos_byte, nchars, nbytes,
   intervals = XSTRING (string)->intervals;
   /* Get the intervals for the part of the string we are inserting--
      not including the combined-before bytes.  */
-  if (nbytes < XSTRING (string)->size_byte)
+  if (nbytes < STRING_BYTES (XSTRING (string)))
     intervals = copy_intervals (intervals, pos, nchars);
                               
   /* Insert those intervals.  */
@@ -1497,7 +1497,7 @@ replace_range (from, to, new, prepare, inherit, nomarkers)
      int from, to, prepare, inherit, nomarkers;
 {
   int inschars = XSTRING (new)->size;
-  int insbytes = XSTRING (new)->size_byte;
+  int insbytes = STRING_BYTES (XSTRING (new));
   int from_byte, to_byte;
   int nbytes_del, nchars_del;
   register Lisp_Object temp;
index 6bb2b0c..fb3d8ba 100644 (file)
@@ -617,11 +617,11 @@ echo_char (c)
       else if (SYMBOLP (c))
        {
          struct Lisp_String *name = XSYMBOL (c)->name;
-         if ((ptr - current_kboard->echobuf) + name->size_byte + 4
+         if ((ptr - current_kboard->echobuf) + STRING_BYTES (name) + 4
              > ECHOBUFSIZE)
            return;
-         bcopy (name->data, ptr, name->size_byte);
-         ptr += name->size_byte;
+         bcopy (name->data, ptr, STRING_BYTES (name));
+         ptr += STRING_BYTES (name);
        }
 
       if (current_kboard->echoptr == current_kboard->echobuf
@@ -2378,7 +2378,7 @@ record_char (c)
            {
              putc ('<', dribble);
              fwrite (XSYMBOL (dribblee)->name->data, sizeof (char),
-                     XSYMBOL (dribblee)->name->size_byte,
+                     STRING_BYTES (XSYMBOL (dribblee)->name),
                      dribble);
              putc ('>', dribble);
            }
@@ -4340,7 +4340,7 @@ parse_modifiers_uncached (symbol, modifier_end)
   modifiers = 0;
   name = XSYMBOL (symbol)->name;
 
-  for (i = 0; i+2 <= name->size_byte; )
+  for (i = 0; i+2 <= STRING_BYTES (name); )
     {
       int this_mod_end = 0;
       int this_mod = 0;
@@ -4387,7 +4387,8 @@ parse_modifiers_uncached (symbol, modifier_end)
 
       /* Check there is a dash after the modifier, so that it
         really is a modifier.  */
-      if (this_mod_end >= name->size_byte || name->data[this_mod_end] != '-')
+      if (this_mod_end >= STRING_BYTES (name)
+         || name->data[this_mod_end] != '-')
        break;
 
       /* This modifier is real; look for another.  */
@@ -4398,7 +4399,7 @@ parse_modifiers_uncached (symbol, modifier_end)
   /* Should we include the `click' modifier?  */
   if (! (modifiers & (down_modifier | drag_modifier
                      | double_modifier | triple_modifier))
-      && i + 7 == name->size_byte
+      && i + 7 == STRING_BYTES (name)
       && strncmp (name->data + i, "mouse-", 6) == 0
       && ('0' <= name->data[i + 6] && name->data[i + 6] <= '9'))
     modifiers |= click_modifier;
@@ -4515,7 +4516,7 @@ parse_modifiers (symbol)
       Lisp_Object mask;
 
       unmodified = Fintern (make_string (XSYMBOL (symbol)->name->data + end,
-                                        XSYMBOL (symbol)->name->size_byte - end),
+                                        STRING_BYTES (XSYMBOL (symbol)->name) - end),
                            Qnil);
 
       if (modifiers & ~(((EMACS_INT)1 << VALBITS) - 1))
@@ -4570,7 +4571,7 @@ apply_modifiers (modifiers, base)
       new_symbol = apply_modifiers_uncached (modifiers,
                                             XSYMBOL (base)->name->data,
                                             XSYMBOL (base)->name->size,
-                                            XSYMBOL (base)->name->size_byte);
+                                            STRING_BYTES (XSYMBOL (base)->name));
 
       /* Add the new symbol to the base's cache.  */
       entry = Fcons (index, new_symbol);
@@ -4818,11 +4819,11 @@ parse_solitary_modifier (symbol)
   switch (name->data[0])
     {
 #define SINGLE_LETTER_MOD(BIT)                         \
-      if (name->size_byte == 1)                                \
+      if (STRING_BYTES (name) == 1)                    \
        return BIT;
 
 #define MULTI_LETTER_MOD(BIT, NAME, LEN)               \
-      if (LEN == name->size_byte                       \
+      if (LEN == STRING_BYTES (name)                   \
          && ! strncmp (name->data, NAME, LEN))         \
        return BIT;
 
@@ -5989,7 +5990,7 @@ read_char_minibuf_menu_prompt (commandflag, nmaps, maps)
 
   /* Prompt string always starts with map's prompt, and a space.  */
   strcpy (menu, XSTRING (name)->data);
-  nlength = XSTRING (name)->size_byte;
+  nlength = STRING_BYTES (XSTRING (name));
   menu[nlength++] = ':';
   menu[nlength++] = ' ';
   menu[nlength] = 0;
@@ -7608,7 +7609,7 @@ DEFUN ("execute-extended-command", Fexecute_extended_command, Sexecute_extended_
 
          newmessage
            = (char *) alloca (XSYMBOL (function)->name->size
-                              + XSTRING (binding)->size_byte
+                              + STRING_BYTES (XSTRING (binding))
                               + 100);
          sprintf (newmessage, "You can run the command `%s' with %s",
                   XSYMBOL (function)->name->data,
@@ -7928,7 +7929,7 @@ stuff_buffered_input (stuffstring)
       register int count;
 
       p = XSTRING (stuffstring)->data;
-      count = XSTRING (stuffstring)->size_byte;
+      count = STRING_BYTES (XSTRING (stuffstring));
       while (count-- > 0)
        stuff_char (*p++);
       stuff_char ('\n');
index c757f1d..7467b49 100644 (file)
@@ -3026,7 +3026,7 @@ describe_vector (vector, elt_prefix, elt_describer,
              tem2 = CHARSET_TABLE_INFO (i - 128, CHARSET_SHORT_NAME_IDX);
              if (STRINGP (tem2))
                insert_from_string (tem2, 0, 0, XSTRING (tem2)->size,
-                                   XSTRING (tem2)->size_byte, 0);
+                                   STRING_BYTES (XSTRING (tem2)), 0);
              else
                insert ("?", 1);
              insert (">", 1);
index 0d04bc0..cfaa8ec 100644 (file)
@@ -1157,12 +1157,12 @@ START and END optionally delimit a substring of STRING from which to read;\n\
   CHECK_STRING (string,0);
 
   if (NILP (end))
-    endval = XSTRING (string)->size_byte;
+    endval = STRING_BYTES (XSTRING (string));
   else
     {
       CHECK_NUMBER (end, 2);
       endval = string_char_to_byte (string, XINT (end));
-      if (endval < 0 || endval > XSTRING (string)->size_byte)
+      if (endval < 0 || endval > STRING_BYTES (XSTRING (string)))
        args_out_of_range (string, end);
     }
 
@@ -2255,7 +2255,7 @@ it defaults to the value of `obarray'.")
 
   tem = oblookup (obarray, XSTRING (string)->data,
                  XSTRING (string)->size,
-                 XSTRING (string)->size_byte);
+                 STRING_BYTES (XSTRING (string)));
   if (!INTEGERP (tem))
     return tem;
 
@@ -2292,7 +2292,7 @@ it defaults to the value of `obarray'.")
 
   tem = oblookup (obarray, XSTRING (string)->data,
                  XSTRING (string)->size,
-                 XSTRING (string)->size_byte);
+                 STRING_BYTES (XSTRING (string)));
   if (!INTEGERP (tem))
     return tem;
   return Qnil;
@@ -2323,7 +2323,7 @@ OBARRAY defaults to the value of the variable `obarray'.")
 
   tem = oblookup (obarray, XSTRING (string)->data,
                  XSTRING (string)->size,
-                 XSTRING (string)->size_byte);
+                 STRING_BYTES (XSTRING (string)));
   if (INTEGERP (tem))
     return Qnil;
   /* If arg was a symbol, don't delete anything but that symbol itself.  */
@@ -2398,7 +2398,7 @@ oblookup (obarray, ptr, size, size_byte)
   else
     for (tail = bucket; ; XSETSYMBOL (tail, XSYMBOL (tail)->next))
       {
-       if (XSYMBOL (tail)->name->size_byte == size_byte
+       if (STRING_BYTES (XSYMBOL (tail)->name) == size_byte
            && XSYMBOL (tail)->name->size == size
            && !bcmp (XSYMBOL (tail)->name->data, ptr, size_byte))
          return tail;
index 3eb1adc..124d8eb 100644 (file)
@@ -480,7 +480,7 @@ read_minibuf (map, initial, prompt, backup_n, expflag,
          /* Ignore trailing whitespace; any other trailing junk is an error.  */
          int i;
          pos = string_char_to_byte (val, pos);
-         for (i = pos; i < XSTRING (val)->size_byte; i++)
+         for (i = pos; i < STRING_BYTES (XSTRING (val)); i++)
            {
              int c = XSTRING (val)->data[i];
              if (c != ' ' && c != '\t' && c != '\n')
@@ -954,9 +954,9 @@ or the symbol from the obarray.")
       /* Is this element a possible completion? */
 
       if (STRINGP (eltstring)
-         && XSTRING (string)->size_byte <= XSTRING (eltstring)->size_byte
+         && STRING_BYTES (XSTRING (string)) <= STRING_BYTES (XSTRING (eltstring))
          && 0 > scmp (XSTRING (eltstring)->data, XSTRING (string)->data,
-                      XSTRING (string)->size_byte))
+                      STRING_BYTES (XSTRING (string))))
        {
          /* Yes. */
          Lisp_Object regexps;
@@ -996,11 +996,11 @@ or the symbol from the obarray.")
          if (NILP (bestmatch))
            {
              bestmatch = eltstring;
-             bestmatchsize = XSTRING (eltstring)->size_byte;
+             bestmatchsize = STRING_BYTES (XSTRING (eltstring));
            }
          else
            {
-             compare = min (bestmatchsize, XSTRING (eltstring)->size_byte);
+             compare = min (bestmatchsize, STRING_BYTES (XSTRING (eltstring)));
              matchsize = scmp (XSTRING (bestmatch)->data,
                                XSTRING (eltstring)->data,
                                compare);
@@ -1012,8 +1012,8 @@ or the symbol from the obarray.")
                     use it as the best match rather than one that is not an
                     exact match.  This way, we get the case pattern
                     of the actual match.  */
-                 if ((matchsize == XSTRING (eltstring)->size_byte
-                      && matchsize < XSTRING (bestmatch)->size_byte)
+                 if ((matchsize == STRING_BYTES (XSTRING (eltstring))
+                      && matchsize < STRING_BYTES (XSTRING (bestmatch)))
                      ||
                      /* If there is more than one exact match ignoring case,
                         and one of them is exact including case,
@@ -1021,15 +1021,15 @@ or the symbol from the obarray.")
                      /* If there is no exact match ignoring case,
                         prefer a match that does not change the case
                         of the input.  */
-                     ((matchsize == XSTRING (eltstring)->size_byte)
+                     ((matchsize == STRING_BYTES (XSTRING (eltstring)))
                       ==
-                      (matchsize == XSTRING (bestmatch)->size_byte)
+                      (matchsize == STRING_BYTES (XSTRING (bestmatch)))
                       && !bcmp (XSTRING (eltstring)->data,
                                 XSTRING (string)->data,
-                                XSTRING (string)->size_byte)
+                                STRING_BYTES (XSTRING (string)))
                       && bcmp (XSTRING (bestmatch)->data,
                                XSTRING (string)->data,
-                               XSTRING (string)->size_byte)))
+                               STRING_BYTES (XSTRING (string)))))
                    bestmatch = eltstring;
                }
              bestmatchsize = matchsize;
@@ -1042,13 +1042,13 @@ or the symbol from the obarray.")
   /* If we are ignoring case, and there is no exact match,
      and no additional text was supplied,
      don't change the case of what the user typed.  */
-  if (completion_ignore_case && bestmatchsize == XSTRING (string)->size_byte
-      && XSTRING (bestmatch)->size_byte > bestmatchsize)
+  if (completion_ignore_case && bestmatchsize == STRING_BYTES (XSTRING (string))
+      && STRING_BYTES (XSTRING (bestmatch)) > bestmatchsize)
     return string;
 
   /* Return t if the supplied string is an exact match (counting case);
      it does not require any change to be made.  */
-  if (matchcount == 1 && bestmatchsize == XSTRING (string)->size_byte
+  if (matchcount == 1 && bestmatchsize == STRING_BYTES (XSTRING (string))
       && !bcmp (XSTRING (bestmatch)->data, XSTRING (string)->data,
                bestmatchsize))
     return Qt;
@@ -1182,15 +1182,15 @@ are ignored unless STRING itself starts with a space.")
       /* Is this element a possible completion? */
 
       if (STRINGP (eltstring)
-         && XSTRING (string)->size_byte <= XSTRING (eltstring)->size_byte
+         && STRING_BYTES (XSTRING (string)) <= STRING_BYTES (XSTRING (eltstring))
          /* If HIDE_SPACES, reject alternatives that start with space
             unless the input starts with space.  */
-         && ((XSTRING (string)->size_byte > 0
+         && ((STRING_BYTES (XSTRING (string)) > 0
               && XSTRING (string)->data[0] == ' ')
              || XSTRING (eltstring)->data[0] != ' '
              || NILP (hide_spaces))
          && 0 > scmp (XSTRING (eltstring)->data, XSTRING (string)->data,
-                      XSTRING (string)->size_byte))
+                      STRING_BYTES (XSTRING (string))))
        {
          /* Yes. */
          Lisp_Object regexps;
@@ -1356,7 +1356,7 @@ test_completion (txt)
       tem = oblookup (Vminibuffer_completion_table,
                      XSTRING (txt)->data,
                      XSTRING (txt)->size,
-                     XSTRING (txt)->size_byte);
+                     STRING_BYTES (XSTRING (txt)));
       if (!SYMBOLP (tem))
        return Qnil;
       else if (!NILP (Vminibuffer_completion_predicate))
@@ -1658,13 +1658,13 @@ Return nil if there is no valid completion, else t.")
            tem = substituted;
            Ferase_buffer ();
            insert_from_string (tem, 0, 0, XSTRING (tem)->size,
-                               XSTRING (tem)->size_byte, 0);
+                               STRING_BYTES (XSTRING (tem)), 0);
          }
       }
     buffer_string = XSTRING (tem)->data;
     completion_string = XSTRING (completion)->data;
-    buffer_nbytes = XSTRING (tem)->size_byte; /* ie ZV_BYTE - BEGV_BYTE */
-    completion_nbytes = XSTRING (completion)->size_byte;
+    buffer_nbytes = STRING_BYTES (XSTRING (tem)); /* ie ZV_BYTE - BEGV_BYTE */
+    completion_nbytes = STRING_BYTES (XSTRING (completion));
     i_byte = buffer_nbytes - completion_nbytes;
     if (i_byte > 0 ||
        0 <= scmp (buffer_string, completion_string, buffer_nbytes))
@@ -1716,7 +1716,7 @@ Return nil if there is no valid completion, else t.")
     int len, c;
 
     completion_string = XSTRING (completion)->data;
-    for (; i_byte < XSTRING (completion)->size_byte; i_byte += len, i++)
+    for (; i_byte < STRING_BYTES (XSTRING (completion)); i_byte += len, i++)
       {
        c = STRING_CHAR_AND_LENGTH (completion_string + i_byte,
                                    XSTRING (completion)->size - i_byte,
index 9484b92..2646592 100644 (file)
@@ -536,7 +536,7 @@ print_string (string, printcharfun)
     /* strout is safe for output to a frame (echo area) or to print_buffer.  */
     strout (XSTRING (string)->data,
            XSTRING (string)->size,
-           XSTRING (string)->size_byte,
+           STRING_BYTES (XSTRING (string)),
            printcharfun, STRING_MULTIBYTE (string));
   else
     {
@@ -544,7 +544,7 @@ print_string (string, printcharfun)
         So re-fetch the string address for each character.  */
       int i;
       int size = XSTRING (string)->size;
-      int size_byte = XSTRING (string)->size_byte;
+      int size_byte = STRING_BYTES (XSTRING (string));
       struct gcpro gcpro1;
       GCPRO1 (string);
       if (size == size_byte)
@@ -1162,7 +1162,7 @@ print (obj, printcharfun, escapeflag)
 #endif
 
          PRINTCHAR ('\"');
-         size_byte = XSTRING (obj)->size_byte;
+         size_byte = STRING_BYTES (XSTRING (obj));
 
          for (i = 0, i_byte = 0; i_byte < size_byte;)
            {
@@ -1234,7 +1234,7 @@ print (obj, printcharfun, escapeflag)
       {
        register int confusing;
        register unsigned char *p = XSYMBOL (obj)->name->data;
-       register unsigned char *end = p + XSYMBOL (obj)->name->size_byte;
+       register unsigned char *end = p + STRING_BYTES (XSYMBOL (obj)->name);
        register int c;
        int i, i_byte, size_byte;
        Lisp_Object name;
@@ -1296,7 +1296,7 @@ print (obj, printcharfun, escapeflag)
            PRINTCHAR (':');
          }
 
-       size_byte = XSTRING (name)->size_byte;
+       size_byte = STRING_BYTES (XSTRING (name));
 
        for (i = 0, i_byte = 0; i_byte < size_byte;)
          {
index 5c5b71e..05c12d1 100644 (file)
@@ -1089,12 +1089,12 @@ Remaining arguments are strings to give program as arguments.")
 #ifdef VMS
   /* Make a one member argv with all args concatenated
      together separated by a blank.  */
-  len = XSTRING (program)->size_byte + 2;
+  len = STRING_BYTES (XSTRING (program)) + 2;
   for (i = 3; i < nargs; i++)
     {
       tem = args[i];
       CHECK_STRING (tem, i);
-      len += XSTRING (tem)->size_byte + 1;     /* count the blank */
+      len += STRING_BYTES (XSTRING (tem)) + 1; /* count the blank */
     }
   new_argv = (unsigned char *) alloca (len);
   strcpy (new_argv, XSTRING (program)->data);
@@ -2756,7 +2756,7 @@ read_process_output (proc, channel)
       char *buf = (char *) xmalloc (nbytes + carryover);
 
       bcopy (XSTRING (p->decoding_buf)->data
-            + XSTRING (p->decoding_buf)->size_byte - carryover,
+            + STRING_BYTES (XSTRING (p->decoding_buf)) - carryover,
             buf, carryover);
       bcopy (chars, buf + carryover, nbytes);
       chars = buf;
@@ -2767,7 +2767,7 @@ read_process_output (proc, channel)
   if (carryover)
     /* See the comment above.  */
     bcopy (XSTRING (p->decoding_buf)->data
-          + XSTRING (p->decoding_buf)->size_byte - carryover,
+          + STRING_BYTES (XSTRING (p->decoding_buf)) - carryover,
           buf, carryover);
 
   if (proc_buffered_char[channel] < 0)
@@ -2799,10 +2799,10 @@ read_process_output (proc, channel)
       int require = decoding_buffer_size (coding, nbytes);
       int result;
       
-      if (XSTRING (p->decoding_buf)->size_byte < require)
+      if (STRING_BYTES (XSTRING (p->decoding_buf)) < require)
        p->decoding_buf = make_uninit_string (require);
       result = decode_coding (coding, chars, XSTRING (p->decoding_buf)->data,
-                             nbytes, XSTRING (p->decoding_buf)->size_byte);
+                             nbytes, STRING_BYTES (XSTRING (p->decoding_buf)));
       carryover = nbytes - coding->consumed;
 
       /* A new coding system might be found by `decode_coding'.  */
@@ -3111,7 +3111,7 @@ send_process (proc, buf, len, object)
              offset = -1;
            }
          bcopy ((XSTRING (XPROCESS (proc)->encoding_buf)->data
-                 + XSTRING (XPROCESS (proc)->encoding_buf)->size_byte
+                 + STRING_BYTES (XSTRING (XPROCESS (proc)->encoding_buf))
                  - carryover),
                 temp_buf,
                 carryover);
@@ -3119,7 +3119,7 @@ send_process (proc, buf, len, object)
          buf = temp_buf;
        }
 
-      if (XSTRING (XPROCESS (proc)->encoding_buf)->size_byte < require)
+      if (STRING_BYTES (XSTRING (XPROCESS (proc)->encoding_buf)) < require)
        {
          XPROCESS (proc)->encoding_buf = make_uninit_string (require);
 
@@ -3133,7 +3133,7 @@ send_process (proc, buf, len, object)
        }
       object = XPROCESS (proc)->encoding_buf;
       encode_coding (coding, buf, XSTRING (object)->data,
-                    len, XSTRING (object)->size_byte);
+                    len, STRING_BYTES (XSTRING (object)));
       len = coding->produced;
       buf = XSTRING (object)->data;
       if (temp_buf)
@@ -3318,7 +3318,7 @@ Output from processes can arrive in between bunches.")
   CHECK_STRING (string, 1);
   proc = get_process (process);
   send_process (proc, XSTRING (string)->data,
-               XSTRING (string)->size_byte, string);
+               STRING_BYTES (XSTRING (string)), string);
   return Qnil;
 }
 \f
index f23c81b..dcf486d 100644 (file)
@@ -135,7 +135,7 @@ compile_pattern_1 (cp, pattern, translate, regp, posix, multibyte)
   if (multibyte == STRING_MULTIBYTE (pattern))
     {
       raw_pattern = (char *) XSTRING (pattern)->data;
-      raw_pattern_size = XSTRING (pattern)->size_byte;
+      raw_pattern_size = STRING_BYTES (XSTRING (pattern));
     }
   else if (multibyte)
     {
@@ -156,7 +156,7 @@ compile_pattern_1 (cp, pattern, translate, regp, posix, multibyte)
       raw_pattern_size = XSTRING (pattern)->size;
       raw_pattern = (char *) alloca (raw_pattern_size + 1);
       copy_text (XSTRING (pattern)->data, raw_pattern,
-                XSTRING (pattern)->size_byte, 1, 0);
+                STRING_BYTES (XSTRING (pattern)), 1, 0);
     }
 
   cp->regexp = Qnil;
@@ -368,8 +368,8 @@ string_match_1 (regexp, string, start, posix)
   re_match_object = string;
   
   val = re_search (bufp, (char *) XSTRING (string)->data,
-                  XSTRING (string)->size_byte, pos_byte,
-                  XSTRING (string)->size_byte - pos_byte,
+                  STRING_BYTES (XSTRING (string)), pos_byte,
+                  STRING_BYTES (XSTRING (string)) - pos_byte,
                   &search_regs);
   immediate_quit = 0;
   last_thing_searched = Qt;
@@ -431,8 +431,8 @@ fast_string_match (regexp, string)
   re_match_object = string;
   
   val = re_search (bufp, (char *) XSTRING (string)->data,
-                  XSTRING (string)->size_byte, 0, XSTRING (string)->size_byte,
-                  0);
+                  STRING_BYTES (XSTRING (string)), 0,
+                  STRING_BYTES (XSTRING (string)), 0);
   immediate_quit = 0;
   return val;
 }
@@ -930,7 +930,7 @@ static int
 trivial_regexp_p (regexp)
      Lisp_Object regexp;
 {
-  int len = XSTRING (regexp)->size_byte;
+  int len = STRING_BYTES (XSTRING (regexp));
   unsigned char *s = XSTRING (regexp)->data;
   unsigned char c;
   while (--len >= 0)
@@ -1004,7 +1004,7 @@ search_buffer (string, pos, pos_byte, lim, lim_byte, n,
      int posix;
 {
   int len = XSTRING (string)->size;
-  int len_byte = XSTRING (string)->size_byte;
+  int len_byte = STRING_BYTES (XSTRING (string));
   register int i;
 
   if (running_asynch_code)
@@ -1143,7 +1143,7 @@ search_buffer (string, pos, pos_byte, lim, lim_byte, n,
        {
          raw_pattern = (char *) XSTRING (string)->data;
          raw_pattern_size = XSTRING (string)->size;
-         raw_pattern_size_byte = XSTRING (string)->size_byte;
+         raw_pattern_size_byte = STRING_BYTES (XSTRING (string));
        }
       else if (multibyte)
        {
@@ -1167,7 +1167,7 @@ search_buffer (string, pos, pos_byte, lim, lim_byte, n,
          raw_pattern_size_byte = XSTRING (string)->size;
          raw_pattern = (char *) alloca (raw_pattern_size + 1);
          copy_text (XSTRING (string)->data, raw_pattern,
-                    XSTRING (string)->size_byte, 1, 0);
+                    STRING_BYTES (XSTRING (string)), 1, 0);
        }
 
       /* Copy and optionally translate the pattern.  */
@@ -1951,13 +1951,13 @@ wordify (string)
 
   adjust = - punct_count + 5 * (word_count - 1) + 4;
   val = make_uninit_multibyte_string (len + adjust,
-                                     XSTRING (string)->size_byte + adjust);
+                                     STRING_BYTES (XSTRING (string)) + adjust);
 
   o = XSTRING (val)->data;
   *o++ = '\\';
   *o++ = 'b';
 
-  for (i = 0; i < XSTRING (val)->size_byte; i++)
+  for (i = 0; i < STRING_BYTES (XSTRING (val)); i++)
     if (SYNTAX (p[i]) == Sword)
       *o++ = p[i];
     else if (i > 0 && SYNTAX (p[i-1]) == Sword && --word_count)
@@ -2283,7 +2283,7 @@ since only regular expressions have distinguished subexpressions.")
 
          accum = Qnil;
 
-         for (pos_byte = 0, pos = 0; pos_byte < XSTRING (newtext)->size_byte;)
+         for (pos_byte = 0, pos = 0; pos_byte < STRING_BYTES (XSTRING (newtext));)
            {
              int substart = -1;
              int subend;
@@ -2693,12 +2693,12 @@ DEFUN ("regexp-quote", Fregexp_quote, Sregexp_quote, 1, 1, 0,
 
   CHECK_STRING (string, 0);
 
-  temp = (unsigned char *) alloca (XSTRING (string)->size_byte * 2);
+  temp = (unsigned char *) alloca (STRING_BYTES (XSTRING (string)) * 2);
 
   /* Now copy the data into the new string, inserting escapes. */
 
   in = XSTRING (string)->data;
-  end = in + XSTRING (string)->size_byte;
+  end = in + STRING_BYTES (XSTRING (string));
   out = temp; 
 
   for (; in != end; in++)
index b9128fa..d05aa17 100644 (file)
@@ -877,7 +877,7 @@ x_consider_frame_title (frame)
      already wasted too much time by walking through the list with
      display_mode_element, then we might need to optimize at a higher
      level than this.)  */
-  if (! STRINGP (f->name) || XSTRING (f->name)->size_byte != len
+  if (! STRINGP (f->name) || STRING_BYTES (XSTRING (f->name)) != len
       || bcmp (frame_title_buf, XSTRING (f->name)->data, len) != 0)
     x_implicitly_set_name (f, make_string (frame_title_buf, len), Qnil);
 }
@@ -3231,7 +3231,7 @@ display_text_line (w, start, start_byte, vpos, hpos, taboffset, ovstr_done)
 
          minibuf_prompt_width
            = (display_string (w, vpos, XSTRING (minibuf_prompt)->data,
-                              XSTRING (minibuf_prompt)->size_byte,
+                              STRING_BYTES (XSTRING (minibuf_prompt)),
                               hpos + WINDOW_LEFT_MARGIN (w),
                               /* Display a space if we truncate.  */
                               ' ',
@@ -4104,7 +4104,7 @@ display_menu_bar (w)
       if (hpos < maxendcol)
        hpos = display_string (w, vpos,
                               XSTRING (string)->data,
-                              XSTRING (string)->size_byte,
+                              STRING_BYTES (XSTRING (string)),
                               hpos, 0, 0, hpos, maxendcol,
                               STRING_MULTIBYTE (string));
       /* Put a space between items.  */
@@ -4311,7 +4311,7 @@ display_mode_element (w, vpos, hpos, depth, minendcol, maxendcol, elt)
                                            minendcol, maxendcol);
                else
                  hpos = display_string (w, vpos, XSTRING (tem)->data,
-                                        XSTRING (tem)->size_byte,
+                                        STRING_BYTES (XSTRING (tem)),
                                         hpos, 0, 1, minendcol, maxendcol,
                                         STRING_MULTIBYTE (tem));
              }
@@ -4607,7 +4607,7 @@ decode_mode_spec (w, c, spec_width, maxwidth)
     case 'b': 
       obj = b->name;
 #if 0
-      if (maxwidth >= 3 && XSTRING (obj)->size_byte > maxwidth)
+      if (maxwidth >= 3 && STRING_BYTES (XSTRING (obj)) > maxwidth)
        {
          bcopy (XSTRING (obj)->data, decode_mode_spec_buf, maxwidth - 1);
          decode_mode_spec_buf[maxwidth - 1] = '\\';
@@ -4641,10 +4641,10 @@ decode_mode_spec (w, c, spec_width, maxwidth)
 #if 0
       if (NILP (obj))
        return "[none]";
-      else if (STRINGP (obj) && XSTRING (obj)->size_byte > maxwidth)
+      else if (STRINGP (obj) && STRING_BYTES (XSTRING (obj)) > maxwidth)
        {
          bcopy ("...", decode_mode_spec_buf, 3);
-         bcopy (XSTRING (obj)->data + XSTRING (obj)->size_byte - maxwidth + 3,
+         bcopy (XSTRING (obj)->data + STRING_BYTES (XSTRING (obj)) - maxwidth + 3,
                 decode_mode_spec_buf + 3, maxwidth - 3);
          return decode_mode_spec_buf;
        }
index bc704cc..6b209b7 100644 (file)
@@ -600,7 +600,7 @@ x_create_bitmap_from_file (f, file)
   dpyinfo->bitmaps[id - 1].pixmap = bitmap;
   dpyinfo->bitmaps[id - 1].refcount = 1;
   dpyinfo->bitmaps[id - 1].file
-    = (char *) xmalloc (XSTRING (file)->size_byte + 1);
+    = (char *) xmalloc (STRING_BYTES (XSTRING (file)) + 1);
   dpyinfo->bitmaps[id - 1].depth = 1;
   dpyinfo->bitmaps[id - 1].height = height;
   dpyinfo->bitmaps[id - 1].width = width;
@@ -1823,14 +1823,14 @@ x_set_name (f, name, explicit)
        text.value = XSTRING (name)->data;
        text.encoding = XA_STRING;
        text.format = 8;
-       text.nitems = XSTRING (name)->size_byte;
+       text.nitems = STRING_BYTES (XSTRING (name));
 
        icon_name = (!NILP (f->icon_name) ? f->icon_name : name);
 
        icon.value = XSTRING (icon_name)->data;
        icon.encoding = XA_STRING;
        icon.format = 8;
-       icon.nitems = XSTRING (icon_name)->size_byte;
+       icon.nitems = STRING_BYTES (XSTRING (icon_name));
 #ifdef USE_X_TOOLKIT
        XSetWMName (FRAME_X_DISPLAY (f),
                    XtWindow (f->output_data.x->widget), &text);
@@ -1913,14 +1913,14 @@ x_set_title (f, name)
        text.value = XSTRING (name)->data;
        text.encoding = XA_STRING;
        text.format = 8;
-       text.nitems = XSTRING (name)->size_byte;
+       text.nitems = STRING_BYTES (XSTRING (name));
 
        icon_name = (!NILP (f->icon_name) ? f->icon_name : name);
 
        icon.value = XSTRING (icon_name)->data;
        icon.encoding = XA_STRING;
        icon.format = 8;
-       icon.nitems = XSTRING (icon_name)->size_byte;
+       icon.nitems = STRING_BYTES (XSTRING (icon_name));
 #ifdef USE_X_TOOLKIT
        XSetWMName (FRAME_X_DISPLAY (f),
                    XtWindow (f->output_data.x->widget), &text);
@@ -2050,7 +2050,7 @@ validate_x_resource_name ()
       unsigned char *p = XSTRING (Vx_resource_name)->data;
       int i;
 
-      len = XSTRING (Vx_resource_name)->size_byte;
+      len = STRING_BYTES (XSTRING (Vx_resource_name));
 
       /* Only letters, digits, - and _ are valid in resource names.
         Count the valid characters and count the invalid ones.  */
@@ -2134,16 +2134,16 @@ and the class is `Emacs.CLASS.SUBCLASS'.")
 
   /* Allocate space for the components, the dots which separate them,
      and the final '\0'.  Make them big enough for the worst case.  */
-  name_key = (char *) alloca (XSTRING (Vx_resource_name)->size_byte
+  name_key = (char *) alloca (STRING_BYTES (XSTRING (Vx_resource_name))
                              + (STRINGP (component)
-                                ? XSTRING (component)->size_byte : 0)
-                             + XSTRING (attribute)->size_byte
+                                ? STRING_BYTES (XSTRING (component)) : 0)
+                             + STRING_BYTES (XSTRING (attribute))
                              + 3);
 
-  class_key = (char *) alloca (XSTRING (Vx_resource_class)->size_byte
-                              + XSTRING (class)->size_byte
+  class_key = (char *) alloca (STRING_BYTES (XSTRING (Vx_resource_class))
+                              + STRING_BYTES (XSTRING (class))
                               + (STRINGP (subclass)
-                                 ? XSTRING (subclass)->size_byte : 0)
+                                 ? STRING_BYTES (XSTRING (subclass)) : 0)
                               + 3);
 
   /* Start with emacs.FRAMENAME for the name (the specific one)
@@ -2202,16 +2202,16 @@ display_x_get_resource (dpyinfo, attribute, class, component, subclass)
 
   /* Allocate space for the components, the dots which separate them,
      and the final '\0'.  Make them big enough for the worst case.  */
-  name_key = (char *) alloca (XSTRING (Vx_resource_name)->size_byte
+  name_key = (char *) alloca (STRING_BYTES (XSTRING (Vx_resource_name))
                              + (STRINGP (component)
-                                ? XSTRING (component)->size_byte : 0)
-                             + XSTRING (attribute)->size_byte
+                                ? STRING_BYTES (XSTRING (component)) : 0)
+                             + STRING_BYTES (XSTRING (attribute))
                              + 3);
 
-  class_key = (char *) alloca (XSTRING (Vx_resource_class)->size_byte
-                              + XSTRING (class)->size_byte
+  class_key = (char *) alloca (STRING_BYTES (XSTRING (Vx_resource_class))
+                              + STRING_BYTES (XSTRING (class))
                               + (STRINGP (subclass)
-                                 ? XSTRING (subclass)->size_byte : 0)
+                                 ? STRING_BYTES (XSTRING (subclass)) : 0)
                               + 3);
 
   /* Start with emacs.FRAMENAME for the name (the specific one)
@@ -2254,7 +2254,7 @@ x_get_resource_string (attribute, class)
 
   /* Allocate space for the components, the dots which separate them,
      and the final '\0'.  */
-  name_key = (char *) alloca (XSTRING (Vinvocation_name)->size_byte
+  name_key = (char *) alloca (STRING_BYTES (XSTRING (Vinvocation_name))
                              + strlen (attribute) + 2);
   class_key = (char *) alloca ((sizeof (EMACS_CLASS) - 1)
                               + strlen (class) + 2);
@@ -4871,7 +4871,8 @@ also be depressed for NEWSTRING to appear.")
 
   if (NILP (modifiers))
     XRebindKeysym (x_current_display, keysym, modifier_list, 0,
-                  XSTRING (newstring)->data, XSTRING (newstring)->size_byte);
+                  XSTRING (newstring)->data,
+                  STRING_BYTES (XSTRING (newstring)));
   else
     {
       register Lisp_Object rest, mod;
@@ -4899,7 +4900,8 @@ also be depressed for NEWSTRING to appear.")
        }
 
       XRebindKeysym (x_current_display, keysym, modifier_list, i,
-                    XSTRING (newstring)->data, XSTRING (newstring)->size_byte);
+                    XSTRING (newstring)->data,
+                    STRING_BYTES (XSTRING (newstring)));
     }
 
   return Qnil;
@@ -4930,7 +4932,7 @@ See the documentation of `x-rebind-key' for more information.")
       if (!NILP (item))
        {
          CHECK_STRING (item, 2);
-         strsize = XSTRING (item)->size_byte;
+         strsize = STRING_BYTES (XSTRING (item));
          rawstring = (unsigned char *) xmalloc (strsize);
          bcopy (XSTRING (item)->data, rawstring, strsize);
          modifier[1] = 1 << i;
index ef51f83..1e6b0b1 100644 (file)
@@ -2436,7 +2436,7 @@ xmenu_show (f, x, y, for_click, keymaps, title, error)
                  j++;
                  continue;
                }
-             width = XSTRING (item)->size_byte;
+             width = STRING_BYTES (XSTRING (item));
              if (width > maxwidth)
                maxwidth = width;
 
@@ -2459,7 +2459,7 @@ xmenu_show (f, x, y, for_click, keymaps, title, error)
            = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_EQUIV_KEY];
          if (!NILP (descrip))
            {
-             int gap = maxwidth - XSTRING (item_name)->size_byte;
+             int gap = maxwidth - STRING_BYTES (XSTRING (item_name));
 #ifdef C_ALLOCA
              Lisp_Object spacer;
              spacer = Fmake_string (make_number (gap), make_number (' '));
@@ -2471,14 +2471,14 @@ xmenu_show (f, x, y, for_click, keymaps, title, error)
                 to reduce gc needs.  */
              item_data
                = (unsigned char *) alloca (maxwidth
-                                           + XSTRING (descrip)->size_byte + 1);
+                                           + STRING_BYTES (XSTRING (descrip)) + 1);
              bcopy (XSTRING (item_name)->data, item_data,
-                    XSTRING (item_name)->size_byte);
+                    STRING_BYTES (XSTRING (item_name)));
              for (j = XSTRING (item_name)->size; j < maxwidth; j++)
                item_data[j] = ' ';
              bcopy (XSTRING (descrip)->data, item_data + j,
-                    XSTRING (descrip)->size_byte);
-             item_data[j + XSTRING (descrip)->size_byte] = 0;
+                    STRING_BYTES (XSTRING (descrip)));
+             item_data[j + STRING_BYTES (XSTRING (descrip))] = 0;
 #endif
            }
          else
index ec8d2af..475a2fd 100644 (file)
@@ -1611,7 +1611,7 @@ lisp_data_to_selection_data (display, obj,
       int num;
 
       *format_ret = 8;
-      *size_ret = XSTRING (obj)->size_byte;
+      *size_ret = STRING_BYTES (XSTRING (obj));
       *data_ret = XSTRING (obj)->data;
       bzero (charsets, (MAX_CHARSET + 1) * sizeof (int));
       num = ((*size_ret <= 1   /* Check the possibility of short cut.  */
@@ -2134,7 +2134,7 @@ DEFUN ("x-store-cut-buffer-internal", Fx_store_cut_buffer_internal,
   buffer_atom = symbol_to_x_atom (FRAME_X_DISPLAY_INFO (selected_frame),
                                  display, buffer);
   data = (unsigned char *) XSTRING (string)->data;
-  bytes = XSTRING (string)->size_byte;
+  bytes = STRING_BYTES (XSTRING (string));
   bytes_remaining = bytes;
 
   if (! FRAME_X_DISPLAY_INFO (selected_frame)->cut_buffers_initialized)
index 9d8e40b..52cb889 100644 (file)
@@ -6933,8 +6933,8 @@ x_term_init (display_name, xrm_option, resource_name)
 #endif /* ! 0 */
 
   dpyinfo->x_id_name
-    = (char *) xmalloc (XSTRING (Vinvocation_name)->size_byte
-                       + XSTRING (Vsystem_name)->size_byte
+    = (char *) xmalloc (STRING_BYTES (XSTRING (Vinvocation_name))
+                       + STRING_BYTES (XSTRING (Vsystem_name))
                        + 2);
   sprintf (dpyinfo->x_id_name, "%s@%s",
           XSTRING (Vinvocation_name)->data, XSTRING (Vsystem_name)->data);